GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(web): closing the last Browser tab hides the right panel again (#… · pingdotgg/t3code@d0b81ce

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src
    • components/preview
      • agentOpenedPreviews.test.ts
    • hooks
      • useRightPanelSurfaceClose.ts
    • rightPanelStore.test.ts
    • rightPanelStore.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/components/preview/agentOpenedPreviews.test.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/components/preview/agentOpenedPreviews.test.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ describe("followPreviewSessions", () => {
258258
useRightPanelStore
259259
.getState()
260260
.byThreadKey[threadKey]?.surfaces.filter((surface) => surface.kind === "preview")
261-
.map((surface) => surface.id);
261+
.map((surface) => surface.id) ?? [];
262262

263263
it("adds visible sessions as tabs and drops tabs whose session ended", () => {
264264
setup();
Collapse file

‎apps/web/src/hooks/useRightPanelSurfaceClose.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/hooks/useRightPanelSurfaceClose.ts
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ export function useRightPanelSurfaceClose(input: {
8888
(left, right) => Number(left.id === activeId) - Number(right.id === activeId),
8989
);
9090
for (const surface of ordered) {
91-
releaseSurfaceResources(threadRef, surface);
91+
// Releasing a browser drops its session, which prunes the tab automatically; close it
92+
// first so the close stays a user action that hides the panel after the last tab.
9293
store.closeSurface(threadRef, surface.id);
94+
releaseSurfaceResources(threadRef, surface);
9395
}
9496
const nextActiveSurface = selectActiveRightPanelSurface(
9597
useRightPanelStore.getState().byThreadKey,
Collapse file

‎apps/web/src/rightPanelStore.test.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/rightPanelStore.test.ts
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,24 @@ describe("rightPanelStore", () => {
11811181
});
11821182
});
11831183

1184+
it("hides the panel when browser reconciliation removes its last session tab", () => {
1185+
const store = useRightPanelStore.getState();
1186+
store.openBrowser(refA, "tab-a");
1187+
store.reconcileBrowserSurfaces(refA, []);
1188+
expect(selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, refA)).toEqual({
1189+
isOpen: false,
1190+
activeSurfaceId: null,
1191+
surfaces: [],
1192+
});
1193+
1194+
store.openBrowser(refA, "tab-b");
1195+
store.open(refA, "diff");
1196+
store.reconcileBrowserSurfaces(refA, []);
1197+
expect(
1198+
selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, refA),
1199+
).toMatchObject({ isOpen: true, activeSurfaceId: "diff" });
1200+
});
1201+
11841202
it("moves a surface to a new index and keeps it there through browser reconciliation", () => {
11851203
const store = useRightPanelStore.getState();
11861204
store.openTerminal(refA, "term-1");
Collapse file

‎apps/web/src/rightPanelStore.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/rightPanelStore.ts
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,8 +972,14 @@ export const useRightPanelStore = create<RightPanelStoreState>()(
972972
(surface) => surface.id === current.activeSurfaceId,
973973
);
974974
const fallbackBrowser = surfaces.find((surface) => surface.kind === "preview");
975+
// A closed session tab was the last surface: hide the panel rather than leave it on
976+
// the empty picker, as a user close would. A dropped `browser:new` placeholder does not count.
977+
const closedLastSessionTab =
978+
surfaces.length === 0 &&
979+
current.surfaces.some((surface) => surface.kind === "preview" && surface.resourceId);
975980
return {
976981
...current,
982+
isOpen: closedLastSessionTab ? false : current.isOpen,
977983
surfaces,
978984
activeSurfaceId: activeStillExists
979985
? current.activeSurfaceId

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.