Bring in react-suspense-fetch
into codebase
#1660
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since
react-suspense-fetch
is no longer maintained but provides a good abstraction for our data providers (probably even after the next React 19 upgrade), and since we would really benefit from being able to introspect the internal cache of thevalueStore
to address #1578 properly once and for all, I bring in the library's source code into our codebase.Of course, I also tweak it to my liking a bit:
Input
andResult
generics (<Result, Input>
just felt unnecessarily confusing).prefetch
beforeget
.preset
method, which was added in a recent version we hadn't upgraded to because of the previous point, to remove our own cache for group children inDataProvider
.In my next PR, I'll try to use the stores' built-in features to cancel requests and evict aborted responses from the cache, instead of our own complicated code in
DataProviderApi
.