-
-
Notifications
You must be signed in to change notification settings - Fork 665
[Regression Bug] Updated atom value not propagated to component #947
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
Comments
Thanks for reporting. I think we miss tests to cover this...
This almost indicates, this is a bug. Note: it works with |
I updated the version in the bug description. |
Hm... I think I also stumbled upon this bug, but for me the last working version is 1.4.6 |
Are you sure? That sounds like a different bug. Thanks for reporting anyway. |
Yeah, maybe different bug, but same behaviour: updated atom value is not reflected in a component. Works in 1.4.6, doesn't work in all other versions > 1.4.6. I'll try to create reproduction sandbox. |
Would you guys try if https://ci.codesandbox.io/status/pmndrs/jotai/pr/960/builds/208213 fixes issues? (See "Local Install Instructions") |
Couldn't test it with my application because it breaks currently because of #967. But as far es I can see it, the test is working and increasing delays also works perfectly. |
See https://ci.codesandbox.io/status/pmndrs/jotai/pr/960 for new builds. |
|
#960 should fix this. |
…ing atom value (#960) * fix: add test case for #947 * wip: partial fix * wip: made a progress * fix test! * handle dependencies change without value change Co-authored-by: daishi <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
I am using an atom (A) to control if an atom (B) should return the value of an atom (C) otherwise a default value is returned. See the example below: https://codesandbox.io/s/dark-http-bsili?file=/src/App.tsx
The problem is, that the changed value of atom (C) is never propagated to the invoking component through
useAtom
. The error occurs when there is no externally triggered rendering within the calling component, which re-evaluates theuseAtom
hook. I think, there is somewhere aflushPending
missing. I tried to figure out what could be a possible fix, but I did not found any good solution.Affects version
1.5.0
. Worked with1.4.2
1.4.9
.BTW: I think the
useEffect
call at https://github.com/pmndrs/jotai/blob/main/src/core/useAtom.ts#L103-L105 should pass its dependencies. If so, a forced rendering has no effect anymore on the bug above.The text was updated successfully, but these errors were encountered: