mirror of
https://github.com/different-ai/openwork
synced 2026-04-25 17:15:34 +02:00
preserve expanded workspaces on session switch
This commit is contained in:
@@ -210,14 +210,10 @@ export function WorkspaceSessionList(props: Props) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const id = props.selectedWorkspaceId.trim();
|
const id = props.selectedWorkspaceId.trim();
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
// Keep the selected workspace expanded and collapse the rest by default.
|
// Keep the selected workspace visible without collapsing other workspaces.
|
||||||
// Without this, repeated switching leaves multiple large session trees open
|
// Collapsing the previous workspace on every cross-workspace session click
|
||||||
// at once, which makes the sidebar increasingly expensive to render as
|
// makes the sidebar feel jumpy and hides the context the user just left.
|
||||||
// histories grow.
|
expandWorkspace(id);
|
||||||
setExpandedWorkspaceIds((previous) => {
|
|
||||||
if (previous.size === 1 && previous.has(id)) return previous;
|
|
||||||
return new Set([id]);
|
|
||||||
});
|
|
||||||
}, [props.selectedWorkspaceId]);
|
}, [props.selectedWorkspaceId]);
|
||||||
|
|
||||||
const previewCount = (workspaceId: string) =>
|
const previewCount = (workspaceId: string) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user