-
-
Notifications
You must be signed in to change notification settings - Fork 589
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
splitAtom(arrayAtom) returns inconsistent length temporarily with multiple renderers since v1.3.3 #728
Comments
https://codesandbox.io/s/react-typescript-forked-gi301?file=/src/App.tsx |
Hm, |
Okay, I found the issue is not reproducible if we don't use react-konva. |
Please see #729. I assumed react-konva triggers action asynchronously, and the error is reproduced. And it is solved with However, I was able to only solve your codesandbox with Do you think you can reproduce the issue without react-konva and/or can you modify the test in #729 to make it fail like with react-konva (even with batchedUpdates)? |
Yes, but the "react-konva" is required. |
But, we don't know what is the problem, thus we can't investigate a possible solution. We would like to fix it for sure. Do you happen to know how react-konva works? Or, can you try to reproduce the issue without react-konva? |
Thanks, I temporarily reverted to 1.3.2 version : ) |
This problem also occurs when using "@inlet/react-pixi". Example: |
We need somebody to help on this. |
Oh, that's good to know! Then, I guess it would be extremely hard to solve this now. react-three-fiber from @pmndrs uses a separate reconciler too. |
So, given that this is not solvable, my suggestion is to use (read) only the result of Here's the fix: https://codesandbox.io/s/react-typescript-forked-6u6pe?file=/src/App.tsx Hope it helps. |
Unfortunately, v1.5.0 doesn't change the behavior. Please use the workaround. |
const itemsAtom = atom([])
const itemAtomsAtom = splitAtom(itemsAtom)
const items= useAtomValue(itemsAtom );
const itemAtoms= useAtomValue(itemAtomsAtom);
items.length ≠ itemAtoms.length ???
The text was updated successfully, but these errors were encountered: