Can createAsyncStore
actually return a store?
#390
Replies: 2 comments
-
Something like this perhaps?
|
Beta Was this translation helpful? Give feedback.
-
One could make something as suggested above. Right now we have some gaps because not all the 2.0 APIs are in place.But generally speaking revalidate should be only for revalidation and mutate shouldn't be for pagination. But for optimistic/projected updates. The async primitives source should reflect the current state of what it holds ideally. Like if paginating I would consider using the previous value passed into |
Beta Was this translation helpful? Give feedback.
-
Hello all!
Noticed the
createAsyncStore
API and thought it would be beneficial to return the resource (or store...or both) helpers to utilize for updating.For example, if you need pagination or realtime updates - using
revalidate
provides a less than ideal experience since it reloads the route on a big update (like pagination for a notes or chat view). So, the only way I know of today (hoping there is a better one @ryansolid ?) is to create a mirror store to use and mutate that is based on the initial resource signal (which I don't love)?So, I'm wondering if there is a possibility to be able to enhance the experience via:
One of the many other ways I know to achieve this today is doing this - which I'm hoping we can simplify for these use cases:
Any thoughts on this? The Async is already so helpful it feels weird to have to go out of your way to update it without causing a refresh in the event of big updates like pagination?
I recently tried this which causes the entire page to reload (vs just adding to the cached data which is what I expected):
Also, if I update the range to say
[100, 200]
it will only return the new stuff and not the new merged with the old.Do you see something I could improve which I might be overlooking? Thanks for the time and help!
Beta Was this translation helpful? Give feedback.
All reactions