Skip to content

Commit 5672c42

Browse files
bostonaholicclaude
andcommitted
fix(channels): keep a drawer-only side pane open across Back/Forward
The history snapshot treated a side pane holding only a retained launcher drawer (Todos, Huddles) as empty and recorded it closed, so Back to that visit hid the drawer even though it was never closed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 45bdb82 commit 5672c42

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎src/bundled/channels/useChannelTabState.test.tsx‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
rootOfTab,
2323
useChannelTabState,
2424
} from "./useChannelTabState";
25+
import type { ChannelDrawerOpening } from "./useChannelPanels";
2526

2627
import {
2728
setThreadPlacementPreference,
@@ -475,6 +476,22 @@ test("verified identity takes precedence over a tab's original hint id", () => {
475476
});
476477
});
477478

479+
test("Back to a visit whose only side content is a retained drawer shows that drawer", () => {
480+
const session = {} as RelaySession;
481+
const h = renderHook(() => useChannelTabState(session, "alpha"));
482+
const drawer = {
483+
panel: { key: "buzz.todos/todos", channelPlacement: "side" },
484+
context: { channelId: "alpha" },
485+
target: "todos",
486+
} as unknown as ChannelDrawerOpening;
487+
act(() => h.result.current.enterVisit("first:channel"));
488+
act(() => h.result.current.setSideDrawer(drawer));
489+
act(() => h.result.current.enterVisit("second:channel"));
490+
act(() => h.result.current.enterVisit("first:channel"));
491+
expect(h.result.current.sideDrawer).toBe(drawer);
492+
expect(h.result.current.paneOpen).toBe(true);
493+
});
494+
478495
// Back/Forward restore each visit's selected tabs and never close a thread.
479496
test("explicit close identifies only the thread's addressed visits, not channel visits retaining its tab", () => {
480497
const session = {} as RelaySession;

‎src/bundled/channels/useChannelTabState.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ const snapshotOf = (state: State): VisitSelection => ({
100100
state.tabs.some((tab) => tabPane(tab) === "side") ||
101101
sideEntries(state).length ||
102102
state.settings ||
103-
state.thread
103+
state.thread ||
104+
state.sideDrawer
104105
),
105106
});
106107
const remember = (state: State) => {

0 commit comments

Comments
 (0)