-
Notifications
You must be signed in to change notification settings - Fork 28
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
Retain state while refreshing #40
Comments
Hey there, I might be misunderstanding but should there be a difference between your two points? Currently Also, why would you want to retain the existing value of |
Yep, it is subtle, but there is a difference. The scenario I’m looking at is:
With the current API there’s not an easy way to differentiate between the A possible API could be to allow an argument to be passed to |
So if I understand correctly you don't want the hooked/subscribed component to go back to the loading state while the refresh is occurring, rather, you'd like the current data to be displayed until the fetch has completed? |
That is correct, yep. A "stale while revalidate" if you will. |
Right! Okay, I think we did discuss this @albertogasparin, I think it shouldn't be too hard to add and I feel it might be a fairly common requirement from consumers. |
Awesome, thanks! It’s definitely something that can be done around the existing API, but it adds a fair bit of boilerplate and I can seem it being a behaviour I’d want to use regularly. |
I’ve just started using this on a project and have a situation where I want to
refresh
the data after a change. At the moment it seems like there’s no easy way to differentiate these states:... and I wondered if there was scope to handle that in some way. Retaining the existing value of
data
would probably be enough I think (though I imagine that has flow-on effects that I am not seeing).The text was updated successfully, but these errors were encountered: