[Bug]: View → Reload / Cmd+R reloads the embedded preview instead of the app whenever a preview exists (macOS) #16378
What happened#
With any preview tab in a thread, View → Reload, Force Reload and Cmd+R reload the embedded preview <webview> instead of the app UI, even after clicking into the chat transcript or raising the main window. The app renderer never reloads, so anything that is only hydrated on page load (for example client settings read from client-settings.json) is not re-read until the whole app restarts.
Steps to reproduce#
- Desktop app on macOS. Open a thread that has a preview tab (the right panel can be closed; the preview webview stays mounted).
- Click into the chat transcript so the app UI has focus.
- Choose View → Reload, or press Cmd+R.
- Watch
~/.t3/userdata/logs/renderer-history.ndjsonanddesktop.trace.ndjson.
Expected#
The main window's renderer reloads: a dom-ready event for surface main and a fresh desktop:get-client-settings IPC.
Actual#
Only dom-ready events for surface preview are recorded. Three menu attempts produced three preview reloads; the main renderer kept the pid it had at app start and no client-settings read happened. The accessibility API reported the main window as the focused window each time.
Why#
apps/desktop/src/window/DesktopApplicationMenu.ts uses the stock { role: "reload" }, { role: "forceReload" } and { role: "toggleDevTools" }. In Electron 44 these roles act on webContents.getFocusedWebContents(), which returns a guest <webview> whenever one reports itself focused, and on macOS an attached webview reports focused whenever its window is frontmost (electron/electron#14631). The same file already works around this for the zoom roles (the comment "Not the zoom roles: those act on the focused webContents…" and zoomClick), but not for reload or devtools.
Suggested fix#
Replace the three roles with click handlers that target the main window's own webContents (reload, reloadIgnoringCache, toggleDevTools), the way zoomClick already targets the main window. Cmd+R while the preview URL bar is focused should keep refreshing the preview; the preview.refresh handling in before-input-event already does that, so only the menu and accelerator fallthrough needs to change.
Workaround#
The only way we found to reload just the app renderer without restarting T3 Code was to trigger the renderer crash-recovery path in DesktopWindow.ts (which reloads the window when the renderer exits with a crash signal). Restarting the app also works but stops every running thread.
Version#
T3 Code Nightly 0.0.46-nightly.20261005.2702 (desktop), macOS 26.5.2, Apple Silicon, Electron 44.4.2.
juliusmarminge added labelsbug
juliusmarminge added labelsvia-triage
juliusmarminge closed this
Sign in to join this conversation.
Note
Grok responding on behalf of Julius.
Triage#
Thanks @shelomo for the clear report and for already pointing at the menu roles and the zoom workaround. That made this quick to trace, and it still reproduces on current
main.What I found#
apps/desktop/src/window/DesktopApplicationMenu.ts. Those roles act onwebContents.getFocusedWebContents(), which returns a guest<webview>as soon as one reports itself focused. That matches your trace: the main window stays frontmost, onlypreviewgetsdom-ready, and the app renderer never reloads.DesktopWindow.zoomMain.ElectronBrowserHostkeeps the webview mounted and only moves an inactive one offscreen, so the wrong target stays around after the panel is closed.PreviewManager'sbefore-input-event(isPreviewRefreshShortcut). A key while focus is in the preview chrome (URL bar and the rest of[data-preview-panel-mode]) goes to the renderer bindingpreview.refresh(mod+rwhenpreviewFocusinpackages/shared/src/keybindings.ts).Likely fix area#
webContents, the same way zoom does.electron/electron#14631was closed as stale on Electron 3, but the menu-role targeting can be handled on the T3 side regardless.A maintainer will decide on the fix direction.