Looking for a useRecoilState_TRANSITION_SUPPORT_UNSTABLE
equivalent: first load suspends - rest use transition
#3049
Replies: 3 comments 3 replies
-
Have you tried using |
Beta Was this translation helpful? Give feedback.
-
When setting the value? I've got quite a big graph of atoms & some of the ones at the root level are Also if there's multiple layers of async atom (which there is) I think it falls afoul of this |
Beta Was this translation helpful? Give feedback.
-
@neil-morrison44 Thank you for posting an interesting code snippet. I think the problem (and UI pattern) you're describing is the same as the one I'm solving in I was trying to solve the problem at the Jotai data layer by cleanly switching atom behaviour from async to sync after the initial load, while you are trying to use React's built-in support for transitions to render new states in the background on subsequent updates instead of displaying loading states. Sort of a data-layer vs view-layer approach? Unfortunately, my workplace is still using legacy React renders, so I haven't looked into how transitions could be used in this way, but is it fair to say that this mainly makes sense when the "cause" of a transition is a user interaction in your application, and not something like a background call to an |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Not sure if I've missed this in the docs but I can't find an equivalent to
useRecoilState_TRANSITION_SUPPORT_UNSTABLE
.I'm looking for something which suspends on first load (unlike
loadable
,unwrap
etc) then every subsequent load A) doesn't suspend and B) starts a React transition.I've got this, which seems to work, but the promise bits are awkward (and probably not robust) & I'm wondering if I've missed a trick somewhere.
Beta Was this translation helpful? Give feedback.
All reactions