jotai
jotai copied to clipboard
Throw error on `useAtom(undefined)` or `useAtom(null)`
Related Bug Reports or Discussions
Fixes #2777
Summary
useAtom(undefined) throws Invalid value used as weak map key
Check List
- [x]
pnpm run prettierfor formatting code and docs
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| jotai | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Nov 11, 2024 10:58am |
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Nice, I like the second one @dai-shi. Simple and won't break apps in production.
Preview in LiveCodes
Latest commit: fceda43586e0e02ad25821260a30006449a41c43
Last updated: Nov 11, 2024 10:58am (UTC)
| Playground | Link |
|---|---|
| React demo | https://livecodes.io?x=id/2T87KR47E |
See documentations for usage instructions.
@dai-shi would that error get thrown in the place we expect / where we are hitting the bug now if we move it?
If that's the preferred path forward I'd need more guidance on where specifically you'd like the check implemented
I added two commits illustrating two ideas. Do they work as expected?
@kevinschaich whenever you have time.
Hey @dai-shi, changes working as expected for me. I think this is OK to move forward with.