Detected multiple Jotai instances. It may cause unexpected behavior with the default store. I want to avoid the warning https://github.com/pmndrs/jotai/discussions/2044 #2439
Replies: 3 comments 4 replies
|
Can you translate your title and description in English, maybe using some machine translators? |
1 reply
It's a lie by ChatGPT. Please don't simply trust what ChatGPT says. |
0 replies
The warning is correct. You are misusing it. You need to use Provider with Next.js. Lines 52 to 68 in c974d15 |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Detected multiple Jotai instances. It may cause unexpected behavior with the default store. #2044
I use AppRoute with Next.js14 and use jotai in WebSocketHook as shown below.
There is no problem when initially displayed in the browser, but the above warning will be displayed when you super reload or change the page.
I checked on ChatGpt and found that it can be suppressed by setting "SUPPRESS_JOTAI_DUPLICATE_INSTANCE_WARNING=true", but I would like to fundamentally solve it if possible.
■Environmental condition
Next.js14
jotai2.7.0
■/src/hooks/WebSocketHook.tsx
■/src/app/(commonlayout)/layout.tsx
■/next.config.js
■/tsconfig.json
All reactions