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 the valueStore 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:
I swap the Input and Result generics (<Result, Input> just felt unnecessarily confusing).
I remove the restriction to always have to call prefetch before get.
I take advantage of the new 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 in DataProvider.
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.
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
.