mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-30 05:02:58 +00:00
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,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