Replies: 3 comments 10 replies
-
Hm, Jotai does nothing async. Wonder if it's something with React.
We need to understand what's happening. Can anyone help? |
Beta Was this translation helpful? Give feedback.
-
When reading the Is it possible to avoid this check and just rely on write time "cache/atom invalidation"? (I've not looked very deeply into the source, so forgive me if this is a naive suggestion) |
Beta Was this translation helpful? Give feedback.
-
While working on #2016 and previously #1959, I would like to see if the alternative approach is possible, essentially as what you said:
It will be a huge rewrite and some existing tests might fail. I'll try it anyway and see how it goes (or not). |
Beta Was this translation helpful? Give feedback.
-
My application follows a tree like structure with over 100,000 nodes, where each node is an atom:
(the tree is actually a couple levels deeper than this)
Each
C
node can be marked as completed, and I need to display the completion % at levelsA
andB
in real-time. To do this, I have aDerivedAtomB
which calculates the completion stats for itsC
children. I then have aDerivedAtomA
which performs the same, but on itsDerivedAtomB
childrenThe calculation of
DerivedAtomA
takes around 800ms and blocks the main thread, which is fine for me. However, after calculating the value ofDerivedAtomA
and returning it to the component, it takes an extra 2-3s for the main thread to be unblocked and the results ofuseAtomValue
to be rendered. Furthermore, when I hide the component and then re-render it, the cached value is instantly returned, however the main thread still takes the same 2-3s to be freed againMy questions are;
useAtomValue
?useAtomValue
thread blocking?Here's some sample code if it helps at all
Beta Was this translation helpful? Give feedback.
All reactions