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(browser): support ssr #895

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

wangsijie
Copy link
Contributor

Summary

support ssr for browser-based SDKs

Check if the window is defined, if not, ignore the storage operations, avoid breaking the server side rendering.

For this kind of SDKs, it doesn't make sense to be used in server side, because the auth state is usually stored in the client side which is not available in server side. So we can safely ignore the storage operations in server side.

fix #890

Testing

Local tested.

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

@wangsijie wangsijie requested a review from a team December 30, 2024 06:15
@wangsijie wangsijie merged commit 733e978 into master Jan 2, 2025
20 checks passed
@wangsijie wangsijie deleted the wangsijie-log-10606-react-sdk-with-nextjs branch January 2, 2025 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

bug: React SDK issue when using with Next.js [ReferenceError: localStorage is not defined]
2 participants