@@ -144,6 +144,18 @@ function RootRouteNotFoundView() {
144144}
145145
146146function RootRouteView ( ) {
147+ // Above every branch: app services raise toasts for the whole page, so the surface they write to
148+ // must not unmount when the root switches branches (for example /welcome to the app shell).
149+ return (
150+ < ToastProvider >
151+ < AnchoredToastProvider >
152+ < RootRouteBranch />
153+ </ AnchoredToastProvider >
154+ </ ToastProvider >
155+ ) ;
156+ }
157+
158+ function RootRouteBranch ( ) {
147159 useEffect ( ( ) => installDesktopPasteAsText ( window . desktopBridge , window ) , [ ] ) ;
148160 const pathname = useLocation ( { select : ( location ) => location . pathname } ) ;
149161 const { authGateState } = Route . useRouteContext ( ) ;
@@ -178,19 +190,17 @@ function RootRouteView() {
178190
179191 if ( pathname === "/welcome" ) {
180192 return (
181- < ToastProvider >
182- < AnchoredToastProvider >
183- < BrowserChromeThemeSync key = { pathname } />
184- < EnvironmentThemeSync />
185- < CustomSnoozeDialogHost />
186- < GuestShareDialogHost />
187- < CommandPalette >
188- < AppSidebarLayout >
189- < Outlet />
190- </ AppSidebarLayout >
191- </ CommandPalette >
192- </ AnchoredToastProvider >
193- </ ToastProvider >
193+ < >
194+ < BrowserChromeThemeSync key = { pathname } />
195+ < EnvironmentThemeSync />
196+ < CustomSnoozeDialogHost />
197+ < GuestShareDialogHost />
198+ < CommandPalette >
199+ < AppSidebarLayout >
200+ < Outlet />
201+ </ AppSidebarLayout >
202+ </ CommandPalette >
203+ </ >
194204 ) ;
195205 }
196206
@@ -212,41 +222,39 @@ function RootRouteView() {
212222 ) ;
213223
214224 return (
215- < ToastProvider >
216- < AnchoredToastProvider >
217- < BrowserChromeThemeSync key = { pathname } />
218- < EnvironmentThemeSync />
219- < ChatGptWelcomeCoordinator />
220- < FirstRunGate
221- enabled = { primaryEnvironmentAuthenticated }
222- hostedStatic = { authGateState . status === "hosted-static" }
223- >
224- { primaryEnvironmentAuthenticated ? < AuthenticatedTracingBootstrap /> : null }
225- { primaryEnvironmentAuthenticated ? < DesktopAppActivationCoordinator /> : null }
226- { primaryEnvironmentAuthenticated ? < DesktopWebLinkCoordinator /> : null }
227- { isElectron ? < RunningThreadKeepAlive /> : null }
228- < RelayClientInstallDialog />
229- < ConnectOnboardingDialog />
230- < SshPasswordPromptDialog />
231- < SnapShotCoordinator />
232- < ReopenClosedViewShortcut />
233- < ConfirmDialogHost />
234- < CustomSnoozeDialogHost />
235- < GuestShareDialogHost />
236- < SlowRpcRequestToastCoordinator />
237- < ProjectCloneToastCoordinator />
238- < AddProjectToMachineDialogHost />
239- < PullRequestGuideRunCoordinator />
240- < HostedStaticEnvironmentBootstrap />
241- { primaryEnvironmentAuthenticated ? (
242- < EventRouter skipInitialBootstrapNavigation = { returningFromWelcome } />
243- ) : null }
244- { appShell }
245- { /* Keep the theme editor above the router so drafts survive navigation. */ }
246- < ThemeEditorHost />
247- </ FirstRunGate >
248- </ AnchoredToastProvider >
249- </ ToastProvider >
225+ < >
226+ < BrowserChromeThemeSync key = { pathname } />
227+ < EnvironmentThemeSync />
228+ < ChatGptWelcomeCoordinator />
229+ < FirstRunGate
230+ enabled = { primaryEnvironmentAuthenticated }
231+ hostedStatic = { authGateState . status === "hosted-static" }
232+ >
233+ { primaryEnvironmentAuthenticated ? < AuthenticatedTracingBootstrap /> : null }
234+ { primaryEnvironmentAuthenticated ? < DesktopAppActivationCoordinator /> : null }
235+ { primaryEnvironmentAuthenticated ? < DesktopWebLinkCoordinator /> : null }
236+ { isElectron ? < RunningThreadKeepAlive /> : null }
237+ < RelayClientInstallDialog />
238+ < ConnectOnboardingDialog />
239+ < SshPasswordPromptDialog />
240+ < SnapShotCoordinator />
241+ < ReopenClosedViewShortcut />
242+ < ConfirmDialogHost />
243+ < CustomSnoozeDialogHost />
244+ < GuestShareDialogHost />
245+ < SlowRpcRequestToastCoordinator />
246+ < ProjectCloneToastCoordinator />
247+ < AddProjectToMachineDialogHost />
248+ < PullRequestGuideRunCoordinator />
249+ < HostedStaticEnvironmentBootstrap />
250+ { primaryEnvironmentAuthenticated ? (
251+ < EventRouter skipInitialBootstrapNavigation = { returningFromWelcome } />
252+ ) : null }
253+ { appShell }
254+ { /* Keep the theme editor above the router so drafts survive navigation. */ }
255+ < ThemeEditorHost />
256+ </ FirstRunGate >
257+ </ >
250258 ) ;
251259}
252260
0 commit comments