From cd6f9004e8f3efbbffe014d9f9d38e3fd79c1724 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Wed, 2 Sep 2026 21:31:41 -0700 Subject: [PATCH] test(terminals): lock the root-state identity of the bailout A `return {}` bailout keeps the map reference but still allocates a new root state, so zustand walks every listener. Assert root identity too. --- .../terminals/terminal-pane-expansion-write-bailout.test.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/renderer/src/store/terminals/terminal-pane-expansion-write-bailout.test.tsx b/src/renderer/src/store/terminals/terminal-pane-expansion-write-bailout.test.tsx index 06dc97ca686..d0d32f7742f 100644 --- a/src/renderer/src/store/terminals/terminal-pane-expansion-write-bailout.test.tsx +++ b/src/renderer/src/store/terminals/terminal-pane-expansion-write-bailout.test.tsx @@ -70,6 +70,8 @@ describe('setTabPaneExpanded', () => { const store = createTestStore() store.getState().setTabPaneExpanded(TAB_ID, false) const before = store.getState().expandedPaneByTabId + // Root identity too: returning `{}` keeps the map but allocates a new root, so zustand still walks every listener. + const rootBefore = store.getState() const published = recordPublishedMapKeys(store) for (let i = 0; i < NO_OP_WRITES; i += 1) { @@ -78,6 +80,7 @@ describe('setTabPaneExpanded', () => { expect(published).toEqual([]) expect(store.getState().expandedPaneByTabId).toBe(before) + expect(store.getState()).toBe(rootBefore) }) it('costs no React commit in a map subscriber when the value is unchanged', () => { @@ -117,6 +120,7 @@ describe('setTabCanExpandPane', () => { const store = createTestStore() store.getState().setTabCanExpandPane(TAB_ID, false) const before = store.getState().canExpandPaneByTabId + const rootBefore = store.getState() const published = recordPublishedMapKeys(store) for (let i = 0; i < NO_OP_WRITES; i += 1) { @@ -125,6 +129,7 @@ describe('setTabCanExpandPane', () => { expect(published).toEqual([]) expect(store.getState().canExpandPaneByTabId).toBe(before) + expect(store.getState()).toBe(rootBefore) }) it('costs no React commit in a map subscriber when the value is unchanged', () => {