data-client: After cache is cleared, some resources are never re-fetched
React version (e.g., 16.8.5) 16.13.1
Concurrent mode yes/no no
Rest Hooks version (e.g., 4.5.9) 4.5.9
Describe the bug
After resetting the cache (using useResetter()), some resources get stuck in a state where they are never refetched, causing any component that depends on them (using useResource()) to be stuck in suspense mode.
To Reproduce Steps to reproduce the behavior:
- Attempt to load a slow-loading resource using
useResource(). - While this resource is loading, reset the cache using
useResetter(). - Attempt to load the same resource again.
- Observe the component stuck in suspense.
Expected behavior In step 3, the resource should be re-fetched.
Additional context
I’m guessing it has to do with this line. The promise is indeed already present in this.fetched, but it’s rejected:

So I’m assuming something in the network manager cleanup should be removing this, or the line referenced above should be checking to see if the promise is still pending, not just if it’s present.
Hopefully this is enough info to track down the bug (or tell me what I’m doing wrong), but if not I can try to create a minimal example to reproduce this.
Thanks for an awesome library!
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15
Regarding types - I have an explanation going up on docs site soon https://github.com/coinbase/rest-hooks/pull/486/files#diff-0ab0428a5fb5dbcd85cd942fb836a6f6ce5ff7b511a2fddd1e76230f55f3b72a
Use cases: I was under the impression there were two use cases: