Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix authState getting wiped on page reload on static websites #712

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Vijayabhaskar96
Copy link
Contributor

πŸ”— Linked issue

#551
This issue occurs because data (data from getSession()) is not stored in the browser, which is not a problem in SSR with server because the server takes care of it, but on a statically generated website, this data is lost along with rawToken even if the token is stored in the browser cookies if you refresh the webpage.

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR stores the retrieved data from getSession() and stores it in the browser cookie auth:sessionCookie and reloads the data and rawToken back on the client side if they're undefined.
This PR fixes the data issue, but you still need to set the prerender:false for middleware protected routes in routeRules so that client-side middleware is forced to run and load the states.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

@zoey-kaiser zoey-kaiser added the bug A bug that needs to be resolved label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that needs to be resolved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants