Skip to content

Commit e41f0f4

Browse files
committed
chore(simplify): drop ctx.state! non-null assertion in __root.tsx
Capture the narrowed state into overlayState (string | null) so the SuspendedView state prop type-checks without the bang.
1 parent d74dd9e commit e41f0f4

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

apps/web/src/routes/__root.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,20 +146,15 @@ export const Route = createRootRouteWithContext<RouterContext>()({
146146
})
147147

148148
function RootComponent() {
149-
// Suspension overlay: render the unavailable/archived message inline
150-
// instead of redirecting to a /suspended URL. Same URL stays in the
151-
// address bar so when the workspace state flips back to active the
152-
// next render shows the actual page content. Exempt paths (login,
153-
// oauth callbacks, magic-link landing) skip the overlay so suspended
154-
// owners can still get back in.
155149
const ctx = Route.useRouteContext()
156150
const pathname = useRouterState({ select: (s) => s.location.pathname })
157-
const showSuspended = ctx.state && ctx.state !== 'active' && !isSuspensionExempt(pathname)
151+
const overlayState =
152+
ctx.state && ctx.state !== 'active' && !isSuspensionExempt(pathname) ? ctx.state : null
158153

159154
return (
160155
<RootDocument>
161156
<OttHandler />
162-
{showSuspended ? <SuspendedView state={ctx.state!} /> : <Outlet />}
157+
{overlayState ? <SuspendedView state={overlayState} /> : <Outlet />}
163158
</RootDocument>
164159
)
165160
}

0 commit comments

Comments
 (0)