query icon indicating copy to clipboard operation
query copied to clipboard

fix(query-core): allow multiple roots to share same QueryClient

Open appden opened this issue 3 years ago • 2 comments

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.

appden avatar Dec 13 '22 23:12 appden

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

codesandbox-ci[bot] avatar Dec 13 '22 23:12 codesandbox-ci[bot]

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     
Impacted Files Coverage Δ
src/core/queryClient.ts
src/devtools/utils.ts
src/core/subscribable.ts
src/react/useInfiniteQuery.ts
src/core/logger.ts
src/core/query.ts
src/devtools/Logo.tsx
src/core/queryCache.ts
src/devtools/styledComponents.ts
src/core/retryer.ts
... and 124 more

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.

codecov-commenter avatar Dec 18 '22 12:12 codecov-commenter