MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / RootComponent

Function RootComponent

apps/host-selfhost/web/routes/__root.tsx:194–244  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

192}
193
194function RootComponent() {
195 const pathname = useRouterState({ select: (s) => s.location.pathname });
196
197 // The join page is public + chromeless: a new user redeeming an invite link
198 // has no session yet, so it renders outside the auth gate and the shell.
199 if (pathname.startsWith("/join/")) {
200 return (
201 <>
202 <Outlet />
203 <Toaster />
204 </>
205 );
206 }
207
208 // The MCP OAuth approval screen: chromeless (no shell) but inside the auth
209 // gate — the user is already signed in (Better Auth's authorize requires a
210 // session before redirecting here). Rendered directly (static import), not as
211 // a lazy route, so it can't hit Vite's dynamic-import dep flake.
212 if (pathname === "/mcp-consent") {
213 return (
214 <AuthProvider>
215 <AuthGate>
216 <McpConsentPage />
217 <Toaster />
218 </AuthGate>
219 </AuthProvider>
220 );
221 }
222
223 // The CLI device-login verification page: chromeless, inside the auth gate
224 // (the user signs in here if needed, then authorizes the code). Same
225 // static-import + pathname-branch convention as /mcp-consent.
226 if (pathname === "/device") {
227 return (
228 <AuthProvider>
229 <AuthGate>
230 <DevicePage />
231 <Toaster />
232 </AuthGate>
233 </AuthProvider>
234 );
235 }
236
237 return (
238 <AuthProvider>
239 <AuthGate>
240 <AuthenticatedApp />
241 </AuthGate>
242 </AuthProvider>
243 );
244}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected