Skip to content

[Regression Bug] Unexpected LocalStorage access breaks Next.js at build time #967

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

Closed
xbaun-mms opened this issue Jan 15, 2022 · 3 comments
Closed

Comments

@xbaun-mms
Copy link

The createJSONStorage factory function shouldn't access the LocalStorage without explicitly being called. Next.js breaks when building because LocalStorage is not available at build time or in SSR mode.

if (!getStringStorage().removeItem) {

const defaultStorage = createJSONStorage(() => localStorage)

Affects version 1.5.1 and above.

@dai-shi
Copy link
Member

dai-shi commented Jan 15, 2022

Should be handled in #951?

@xbaun
Copy link
Contributor

xbaun commented Jan 15, 2022

Sorry, didn't see the issue. This issue can be closed as it is a duplicate of #951.

@dai-shi
Copy link
Member

dai-shi commented Jan 15, 2022

#951 is already merged and released: https://github.com/pmndrs/jotai/releases/tag/v1.5.2

@dai-shi dai-shi closed this as completed Jan 15, 2022
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

No branches or pull requests

3 participants