-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
setting an atom with a promise results in deleting atomState with read promise
error
#475
Comments
Thanks for reporting. It turns out this is valid and not a bug. https://ci.codesandbox.io/status/pmndrs/jotai/pr/471/builds/129397 yarn add https://pkg.csb.dev/pmndrs/jotai/commit/b246b77a/jotai Would you try the csb build to confirm it? |
@dai-shi - I tried the dev build and the error has gone away but now I'm getting this error:
it seems like resetting the Suspense element is not allowed. |
Thanks for trying. |
okay. this actually works on the dom: https://codesandbox.io/s/react-typescript-forked-813p1?file=/src/App.tsx It must be an issue with the react-blessed renderer. |
thanks for your help! |
I put together an example here:
https://github.com/zcaudate/js-blessed.store-test
but basically I'm getting an error when using atoms with Suspense.
I'd like to be able to have an atom that is initialised with nil, can have a promise resolving to some data and then be reset back to nil.
So in the example, the atom's initial value is
null
. createRecord is basically createatom
with some metadata stuffed into it:Then I set the atom's value to a promise (which resolves after a time out) and it produces this error in the suspense element:
This is a bug or a feature of atoms in jotai and if it's a feature, how do I implement a resettable atom with a promise?
The text was updated successfully, but these errors were encountered: