Comments (14)
Can any of you confirm if #2585 fixes your case?
https://ci.codesandbox.io/status/pmndrs/jotai/pr/2585
☝️ Find "Local Install Instructions"
from jotai.
Having the same issue for sessionStorage.
I believe 2.8.2 start calling the storage fn on server side.
from jotai.
@dai-shi it works, thanks!
PS: I'm using yarn v4: this version should be added in the second step of "Local Install Instructions" of CodeSandbox CI
from jotai.
Does it work with v2.8.1? Otherwise, it's probably a different thing.
from jotai.
It correctly works with jotai <= 2.8.1.
In #2581, we discussed and solved the issue specific with v2.8.2.
If v2.8.1 doesn't solve your case, please open a new bug report 👉 https://github.com/pmndrs/jotai/discussions/new?category=bug-report
Or, a question https://github.com/pmndrs/jotai/discussions/new?category=q-a if you don't have a reproduction.
from jotai.
Thanks @dai-shi for the quick response.
#2639
And I will open an issue once I can reproduce it in stackblitz/codesandbox or a repo.
Really love this lib by the. way, appreciate all your hard work sensei
from jotai.
Ohhhh, that was it. #2539 (comment)
Thanks for reporting.
#2539 broke it.
@mhsattarian Would you like to fix?
from jotai.
@dai-shi on it.
from jotai.
Thanks for confirming!
(Yeah, but it's out of my control.)
from jotai.
@dai-shi
Checking with version 2.8.4
I am still getting:
15:18:41 [vite] Error when evaluating SSR module /src/components/wizard/wizard.tsx:
|- ReferenceError: sessionStorage is not defined
my code:
const storage = createJSONStorage<WizardAtom>(() => sessionStorage)
from jotai.
Also tested with the Local Instructions:
npm i https://pkg.csb.dev/pmndrs/jotai/commit/982fd7c7/jotai
same error
from jotai.
it is hard for me create a reproduction as I am using vite + fastify to create an SSR output
from jotai.
Nope, same issue. as in I can reproduce it in v2.8.1
from jotai.
15:52:21 [vite] Error when evaluating SSR module /src/atoms/wizard-data-atom.ts:
|- ReferenceError: localStorage is not defined
at eval (/src/atoms/wizard-data-atom.ts:7:63)
at Object.getItem (/node_modules/jotai/esm/vanilla/utils.mjs:372:31)
at Module.atomWithStorage (/node_modules/jotai/esm/vanilla/utils.mjs:419:25)
at eval (/src/atoms/wizard-data-atom.ts:8:46)
at async instantiateModule (/vite/dist/node/chunks/dep-C1-ZB6nQ.js:53451:5)
from jotai.
Related Issues (20)
- atomWithStorage not working in ReactNative HOT 1
- webpack support
- Fix Support Page HOT 4
- Nextjs 14 app router webpack error
- Idea: lazy initialization for primitive atoms HOT 17
- Investigate and fix possible memory leaks in `store2` HOT 6
- Store type is not exported for createStore() HOT 2
- Migrate to pnpm HOT 1
- Children components don't see update of one atom in parent one HOT 1
- Possible regression of 2.6.4 with derived atoms HOT 3
- atomWithImmer not resolving the types hint properly
- [BUG]: AtomWithStorage should not return initialvalue
- help wanted
- Atoms aborted due to unmount are unrecoverable HOT 5
- Replace `fast-deep-equal` with `dequal`
- Not unmounted as expected
- [TypeScript] Add `undefined` to Atom definition
- Error using atomWithStorage with getOnInit in Next.js: "localStorage is not defined"
- 🛠️ Repo: ESLint is running TypeScript rules on .json files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jotai.