The external globalThis.jotaiAtomCache's entry shadows the internal one, so the internal get function actually returns undefined instead of an atom, and that undefined is passed to useAtomValue and caused the error. It happens when I call atom initializer in atomFamily or jotai-molecule molecule initializer, etc.
Environment:
next.config.js:
Why it happen: The following lines in _component.js
are compiled to the following lines in .next/server/app/page.js:
The external
globalThis.jotaiAtomCache
's entry shadows the internal one, so the internal get function actually returns undefined instead of an atom, and that undefined is passed to useAtomValue and caused the error. It happens when I callatom
initializer in atomFamily or jotai-molecule molecule initializer, etc.