Skip to content

Commit 79a0764

Browse files
committed
fix(webapp): navigation always collapses fullscreen chat
1 parent 9789afd commit 79a0764

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

apps/webapp/app/components/dashboard-agent/chat-open-mode.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,12 @@ describe("useAgentPanelMode", () => {
8181
act(() => hook.current.revertFullscreen());
8282
expect(hook.current.mode).toBe("rightPanel");
8383
});
84+
85+
it("revertFullscreen always collapses to floating, even when the preference is fullscreen", () => {
86+
const hook = renderAgentPanelMode("fullscreen");
87+
expect(hook.current.mode).toBe("fullscreen");
88+
89+
act(() => hook.current.revertFullscreen());
90+
expect(hook.current.mode).toBe("floating");
91+
});
8492
});

apps/webapp/app/components/dashboard-agent/panel-layout.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,15 @@ export function useAgentPanelMode(modePreference: DashboardAgentMode | undefined
8585
setMode(initialAgentMode(modePreference));
8686
}, [modePreference]);
8787

88-
// Pathname changes must drop fullscreen back to the preference, but leave any other
89-
// transient mode (e.g. rightPanel) alone.
88+
// Pathname changes must drop fullscreen so the new page is visible, even when the
89+
// preference itself is fullscreen — the preference governs the next open, not
90+
// mid-session navigation. Any other transient mode (e.g. rightPanel) is left alone.
9091
const revertFullscreen = useCallback(() => {
91-
setMode((current) => (current !== "fullscreen" ? current : initialAgentMode(modePreference)));
92+
setMode((current) => {
93+
if (current !== "fullscreen") return current;
94+
const next = initialAgentMode(modePreference);
95+
return next === "fullscreen" ? "floating" : next;
96+
});
9297
}, [modePreference]);
9398

9499
return { mode, changeMode, resetToPreference, revertFullscreen };

0 commit comments

Comments
 (0)