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:
Mohamed Boudra
2026-10-23 15:57:12 +07:00
committed by GitHub
parent 6405edd8dc
commit 582beeb10b
35 changed files with 563 additions and 99 deletions
@@ -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>;