Skip to content

fix(session): share auth state via SessionProvider to stop redirect loop#239

Merged
Azfe merged 1 commit into
developfrom
fix/session-provider-redirect-loop
Jul 11, 2026
Merged

fix(session): share auth state via SessionProvider to stop redirect loop#239
Azfe merged 1 commit into
developfrom
fix/session-provider-redirect-loop

Conversation

@Azfe

@Azfe Azfe commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

The role guard in (app)/_layout redirects manager/staff away from the admin tab, which the tab navigator restores from the previous session. Each redirect remounted the layout with a fresh useSession() stuck back at 'loading'; the layout renders null while loading, unmounting its own before the navigation landed — an endless loop that left the app on a blank screen with
no error.

Hoist the session into a SessionProvider mounted at the root layout so it resolves once and never falls back to 'loading' on remount, and swallow a rejected getSession() instead of hanging in 'loading' forever.

@Azfe
Azfe merged commit 1141796 into develop Jul 11, 2026
6 checks passed
@Azfe
Azfe deleted the fix/session-provider-redirect-loop branch July 11, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant