t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Workspace panes: opening a second image from the file tree crashes with React #185 in rightPanelStore.syncFromLayout

Open daviesayo opened this issue 1 week ago • 4 comments

Filed by Claude Opus 5.5 on behalf of Davies.

What happened

On a local build of the workspace-panes redesign (#28845), opening an image from the right-hand file tree and then clicking a second image straight away crashes the renderer to "Something went wrong." with Minified React error #185 (Maximum update depth exceeded). It reproduces every time. The same steps on T3 Code Nightly 0.1.12-nightly.20261121.5024 do not crash.

@maria-rcks, this looks specific to the redesign's layout/surface sync, so flagging it to you directly.

Diagnosis

The build ships without source maps, so I matched the minified frames to the source snapshot it was built from.

The loop runs through the layout-to-panel sync:

  1. surfaceSync → onLayoutChange (apps/web/src/layout/surfaceSync.ts, the "store's shown surface follows focus" block near the end of the function) calls useRightPanelStore.getState().syncFromLayout(threadRef, { activeSurfaceId }) when the focused layout tab changes to a surface tab. The crashing frame surfaceSync-*.js:1:8061 is exactly this call. The other two syncFromLayout calls in that chunk sit at columns 6994 and 7901.
  2. syncFromLayout (apps/web/src/rightPanelStore.ts) runs the Zustand setState, which notifies its listeners (Set.forEach).
  3. A useSyncExternalStore subscriber sees a changed snapshot and schedules a sync re-render (React forceStoreRerender → markUpdateLaneFromFiberToRoot). React's nested-update guard throws #185 after 50 nested updates.

So focus keeps moving between surface tabs during commit: something re-focuses a layout tab on each render, and each re-focus triggers onLayoutChange → syncFromLayout again. The likely partner is a layout effect in layout/PaneTabs.tsx or layout/SurfaceHost.tsx that calls focusTab, or the syncThreadSurfaces → focusTab path when the second file surface replaces or joins the first. I did not confirm which one. The full stack below stops at the store call.

useLayoutSurfaceSync, surfaceSync.ts and the syncFromLayout action don't exist on Nightly, which matches Nightly not crashing.

Steps to reproduce

  1. Run a build of the workspace-panes redesign (#28845 stack).
  2. Open a project thread and open the file tree in the right-hand panel.
  3. Click an image file. It opens in a preview.
  4. Straight away, click a second image file in the tree.
  5. The app shows "Something went wrong." with React error #185.

Version

Local build labelled "T3 Code (Maria) 0.1.10", built 2026-11-21 from a source snapshot of the redesign stack (maria/redesign/*, #28845) merged onto main. Exact commit unknown. The snapshot has no .git.

Nightly comparison: 0.1.12-nightly.20261121.5024 does not reproduce. The triage CLI was the Nightly app's.

Environment

  • macOS 27.0 (darwin arm64), Apple silicon laptop
  • Desktop app connected to the local server on the same Mac

Evidence

Full error report from the app's Copy error button:

T3 Code (Maria) 0.1.10
Time: 2026-11-21T05:49:39.937Z

Error: Minified React error #185; visit https://react.dev/errors/185 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at Pi (t3code://app/assets/authRedirect-DQXCaLIr.js:34:28261)
    at Mi (t3code://app/assets/authRedirect-DQXCaLIr.js:34:27834)
    at Cs (t3code://app/assets/authRedirect-DQXCaLIr.js:34:53914)
    at t3code://app/assets/authRedirect-DQXCaLIr.js:34:53795
    at t3code://app/assets/utils-CcsOJQJc.js:39:84279
    at Set.forEach (<anonymous>)
    at r (t3code://app/assets/utils-CcsOJQJc.js:39:84268)
    at t3code://app/assets/utils-CcsOJQJc.js:39:85619
    at Object.syncFromLayout (t3code://app/assets/rightPanelStore-CNcunPkk.js:1:18241)
    at ae (t3code://app/assets/surfaceSync-CpVTX1BS.js:1:8061)

Frame mapping from the shipped bundle:

  • authRedirect-*.js:34:28261 is React's throwIfInfiniteUpdateLoop (if (50 < nestedUpdateCount) throw Error(185)).
  • :53914/:53795 are useSyncExternalStore's forceStoreRerender and its subscribe callback.
  • utils-*.js:39:84268–84279 is Zustand's setState → listeners.forEach.

Related issues

  • #28845: the workspace-panes PR this code comes from.
  • Earlier #185 crashes with different causes: #27168, #15120, #9390.

Fix applied or workaround

None applied. Workaround: use Nightly, which does not have this code.

Filed by

Claude Opus 5.5 (Claude Code), running a T3 Code triage session.

daviesayo avatar Nov 21 '26 05:11 daviesayo

@daviesayo Does it still crash on the current head of the #28845 branch (d3f69e5018)? If it does, how were the panes laid out when you clicked the images: was the file tree its own tab beside the chat, or the explorer inside an open file preview, and did the second image open in the same pane as the first or in another one?

juliusmarminge avatar Nov 21 '26 06:11 juliusmarminge

@juliusmarminge yes, it still crashes on a rebuild that includes the current #28845 head, 1d12241ddd, which is newer than d3f69e5018. layout/surfaceSync.ts and rightPanelStore.ts in that build match the branch head.

Layout:

  • The file tree was the explorer inside an open file preview, not its own tab beside the chat.
  • The first image opened in that preview. Clicking a second image in the same explorer never opened it, because the app crashed straight away.

Same frame as before, from the rebuilt bundle:

Error: Minified React error #185
    at Pi (authRedirect-D2wIU9KN.js:34:28261)
    at Mi (authRedirect-D2wIU9KN.js:34:27834)
    at Cs (authRedirect-D2wIU9KN.js:34:53914)
    at authRedirect-D2wIU9KN.js:34:53795
    at utils-BwRDLLvZ.js:39:84279
    at Set.forEach (<anonymous>)
    at r (utils-BwRDLLvZ.js:39:84268)
    at utils-BwRDLLvZ.js:39:85619
    at Object.syncFromLayout (rightPanelStore-CZMu3mWL.js:1:18241)
    at ae (surfaceSync-D2gmkU0o.js:1:8061)

Posted by Claude Opus 5.5 (Claude Code) on behalf of Davies.

daviesayo avatar Nov 21 '26 11:11 daviesayo

@daviesayo Does it still crash in a fresh profile with Settings › Layout at its defaults? If it only crashes in your current profile, which Settings › Layout values differ from the defaults, and how many panes and columns were open (and which tabs were in them) when you clicked the second image?

juliusmarminge avatar Nov 21 '26 11:11 juliusmarminge

Closing: no reply in 7 days after we asked for more information. Comment with the missing details and we will reopen.

juliusmarminge avatar Nov 28 '26 11:11 juliusmarminge