fix(auth): force full page reload on auth navigation#43
Conversation
📝 WalkthroughWalkthroughNavigation behavior updated across three authentication-related components to use external navigation option. All sign-out, sign-in, and sign-up routes now include Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
JoachimLK
left a comment
There was a problem hiding this comment.
Hey, thanks for taking the time to look at the codebase and submit a PR! Really appreciate it 🙏
That said, I can't merge this one. A couple of issues:
The second navigateTo call never actually runs — the first one already navigates away, so it's dead code
Adding external: true on internal routes like /dashboard forces a full page reload instead of a smooth navigation, which is actually slower for users
The PR description is empty — I'd love to understand what problem you were trying to solve!
Were you running into a specific bug with navigation? If so, drop a description and I'm happy to dig into it with you. And if you're looking to contribute, check out the good first issue label — there's some good stuff in there to get started with 👍
|
Hi, thanks for the feedback! I've updated the PR description to clarify the intent and the problem this change is addressing. Sign In: After clicking “Sign In”, the UI gets stuck on the “Signing in...” state and does not navigate to /dashboard. A manual refresh (F5) is required for the redirect to happen. Sign Up: After signing up, the app redirects to /auth/sign-in. However, after refreshing the page, it correctly redirects to /onboarding/create-org. Sign Out: After clicking “Sign Out”, the app remains on the dashboard instead of redirecting to /auth/sign-in. A manual refresh is required for the redirect. Please let me know if you’d like me to investigate a more proper fix instead of forcing a full reload — I’m happy to dig deeper into the root cause. |
|
Hey @ntuan2502, thanks again for the detailed follow-up with the screen recordings. That really helped confirm the root cause! I went ahead and implemented a proper fix in #49 (now merged into main) using clearNuxtData() instead of forcing full page reloads. This invalidates the stale Nuxt fetch cache after auth state changes, which is the actual root cause you identified. Closing this PR in favor of #49, but your investigation was genuinely helpful in pointing this out. Thanks for contributing! 🙏 |
Summary
What does this PR change?
This PR forces a full page reload on authentication-related navigation (sign in, sign up, and sign out) instead of relying on client-side navigation.
Specifically, it ensures that after auth state changes, the app performs a hard reload to reflect the correct authenticated route.
Why is this needed?
There are several issues with the current navigation behavior:
On the Sign In page, after clicking "Sign In", the UI gets stuck on "Signing in..." and does not navigate to the dashboard. A manual refresh (F5) is required to proceed to /dashboard.
On the Sign Up page, after signing up, the app redirects to /auth/sign-in. However, after a manual refresh, it correctly redirects to /onboarding/create-org.
On Sign Out, after clicking "Sign Out", the app remains stuck on the dashboard. Only after refreshing does it redirect to /auth/sign-in.
Because the authentication state appears to be correctly updated but the client-side router does not immediately reflect it, forcing a full page reload ensures the correct route is rendered based on the updated auth state.
Type of change
Validation
DCO
Signed-off-by) viagit commit -sSummary by CodeRabbit