fix(app): preserve compact sidebar context under sheets (#7693)
Keep compact sidebars open while users inspect Search, Import session, Add project, or file sheets. Reveal the resolved destination when navigation commits, and place compact workspace sheets above both sidebars while preserving shared editing and cache state.
This commit is contained in:
1 parent
6405edd8dc
commit
582beeb10b
35 files changed
+563
-99
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { createContext, useContext, useState, type ReactNode } from "react";
|
||||
import React, { createContext, useCallback, useContext, useState, type ReactNode } from "react";
|
||||
import invariant from "tiny-invariant";
|
||||
import { buildDiffDocumentModel, retainReusableModels, reviewGeometryKey } from "./model";
|
||||
import type {
|
||||
@@ -162,6 +162,16 @@ function paletteKey(palette: DiffPalette): string {
|
||||
|
||||
const WorkspaceCacheContext = createContext<DiffDocumentWorkspaceCache | null>(null);
|
||||
|
||||
export function useDiffDocumentWorkspaceCacheBridge() {
|
||||
const cache = useDiffDocumentWorkspaceCache();
|
||||
return useCallback(
|
||||
(children: ReactNode) => (
|
||||
<WorkspaceCacheContext.Provider value={cache}>{children}</WorkspaceCacheContext.Provider>
|
||||
),
|
||||
[cache],
|
||||
);
|
||||
}
|
||||
|
||||
export function DiffDocumentWorkspaceCacheProvider({ children }: { children: ReactNode }) {
|
||||
const [cache] = useState(createDiffDocumentWorkspaceCache);
|
||||
return <WorkspaceCacheContext.Provider value={cache}>{children}</WorkspaceCacheContext.Provider>;
|
||||
|
||||
Reference in new issue
Block a user