fix(query-core): allow multiple roots to share same QueryClient
If two roots shared the QueryClient instance, then it would never unsubscribe from online/focus manager listeners and would also forever receive duplicate events because the unsubscriber functions would get "forgotten".
These issues would be especially noticeable on React Native apps where multiple roots that share the same QueryClient are common.
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit 27ad7dc8ac9babc4864640de9e93b4301339e1f7:
| Sandbox | Source |
|---|---|
| @tanstack/query-example-react-basic-typescript | Configuration |
| @tanstack/query-example-solid-basic-typescript | Configuration |
| @tanstack/query-example-vue-basic | Configuration |
Codecov Report
Base: 96.36% // Head: 92.40% // Decreases project coverage by -3.95% :warning:
Coverage data is based on head (
f00b8e7) compared to base (eab6e2c). Patch has no changes to coverable lines.
Additional details and impacted files
@@ Coverage Diff @@
## main #4636 +/- ##
==========================================
- Coverage 96.36% 92.40% -3.96%
==========================================
Files 45 89 +44
Lines 2281 3765 +1484
Branches 640 984 +344
==========================================
+ Hits 2198 3479 +1281
- Misses 80 270 +190
- Partials 3 16 +13
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.