Skip to content

The agent that grows with you

fix(desktop): snapshot Close All pane ids before persist-close

686f6c610ecbf1ce912e
diff --git a/apps/desktop/src/store/session-states.ts b/apps/desktop/src/store/session-states.ts
index f4b1825cc54..3fe052f072a 100644
--- a/apps/desktop/src/store/session-states.ts
+++ b/apps/desktop/src/store/session-states.ts
@@ -1521,7 +1521,9 @@ export function closeSessionTile(storedSessionId: string) {
*/
export function closeAllOpenSessionTiles(paneId: string): void {
const tree = $layoutTree.get()
- const panes = (tree ? findGroupOfPane(tree, paneId) : null)?.panes ?? []
+ // Copy the live group list. closeSessionTile can rewrite the layout
+ // tree; iterating the original array would skip every other pane.
+ const panes = [...((tree ? findGroupOfPane(tree, paneId) : null)?.panes ?? [])]
for (const id of panes) {
if (id.startsWith(TILE_PANE_PREFIX)) {