@tanstack/react-query 4.27.0 → 4.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/build/lib/Hydrate.esm.js +1 -0
  2. package/build/lib/Hydrate.esm.js.map +1 -1
  3. package/build/lib/Hydrate.js +1 -0
  4. package/build/lib/Hydrate.js.map +1 -1
  5. package/build/lib/Hydrate.mjs +1 -0
  6. package/build/lib/Hydrate.mjs.map +1 -1
  7. package/build/lib/QueryClientProvider.esm.js +1 -0
  8. package/build/lib/QueryClientProvider.esm.js.map +1 -1
  9. package/build/lib/QueryClientProvider.js +1 -0
  10. package/build/lib/QueryClientProvider.js.map +1 -1
  11. package/build/lib/QueryClientProvider.mjs +1 -0
  12. package/build/lib/QueryClientProvider.mjs.map +1 -1
  13. package/build/lib/QueryErrorResetBoundary.esm.js +1 -0
  14. package/build/lib/QueryErrorResetBoundary.esm.js.map +1 -1
  15. package/build/lib/QueryErrorResetBoundary.js +1 -0
  16. package/build/lib/QueryErrorResetBoundary.js.map +1 -1
  17. package/build/lib/QueryErrorResetBoundary.mjs +1 -0
  18. package/build/lib/QueryErrorResetBoundary.mjs.map +1 -1
  19. package/build/lib/errorBoundaryUtils.esm.js +1 -0
  20. package/build/lib/errorBoundaryUtils.esm.js.map +1 -1
  21. package/build/lib/errorBoundaryUtils.js +1 -0
  22. package/build/lib/errorBoundaryUtils.js.map +1 -1
  23. package/build/lib/errorBoundaryUtils.mjs +1 -0
  24. package/build/lib/errorBoundaryUtils.mjs.map +1 -1
  25. package/build/lib/isRestoring.esm.js +1 -0
  26. package/build/lib/isRestoring.esm.js.map +1 -1
  27. package/build/lib/isRestoring.js +1 -0
  28. package/build/lib/isRestoring.js.map +1 -1
  29. package/build/lib/isRestoring.mjs +1 -0
  30. package/build/lib/isRestoring.mjs.map +1 -1
  31. package/build/lib/reactBatchedUpdates.esm.js +1 -0
  32. package/build/lib/reactBatchedUpdates.esm.js.map +1 -1
  33. package/build/lib/reactBatchedUpdates.js +1 -0
  34. package/build/lib/reactBatchedUpdates.js.map +1 -1
  35. package/build/lib/reactBatchedUpdates.mjs +1 -0
  36. package/build/lib/reactBatchedUpdates.mjs.map +1 -1
  37. package/build/lib/useBaseQuery.esm.js +1 -0
  38. package/build/lib/useBaseQuery.esm.js.map +1 -1
  39. package/build/lib/useBaseQuery.js +1 -0
  40. package/build/lib/useBaseQuery.js.map +1 -1
  41. package/build/lib/useBaseQuery.mjs +1 -0
  42. package/build/lib/useBaseQuery.mjs.map +1 -1
  43. package/build/lib/useInfiniteQuery.esm.js +1 -0
  44. package/build/lib/useInfiniteQuery.esm.js.map +1 -1
  45. package/build/lib/useInfiniteQuery.js +1 -0
  46. package/build/lib/useInfiniteQuery.js.map +1 -1
  47. package/build/lib/useInfiniteQuery.mjs +1 -0
  48. package/build/lib/useInfiniteQuery.mjs.map +1 -1
  49. package/build/lib/useIsFetching.esm.js +1 -0
  50. package/build/lib/useIsFetching.esm.js.map +1 -1
  51. package/build/lib/useIsFetching.js +1 -0
  52. package/build/lib/useIsFetching.js.map +1 -1
  53. package/build/lib/useIsFetching.mjs +1 -0
  54. package/build/lib/useIsFetching.mjs.map +1 -1
  55. package/build/lib/useIsMutating.esm.js +1 -0
  56. package/build/lib/useIsMutating.esm.js.map +1 -1
  57. package/build/lib/useIsMutating.js +1 -0
  58. package/build/lib/useIsMutating.js.map +1 -1
  59. package/build/lib/useIsMutating.mjs +1 -0
  60. package/build/lib/useIsMutating.mjs.map +1 -1
  61. package/build/lib/useMutation.esm.js +1 -0
  62. package/build/lib/useMutation.esm.js.map +1 -1
  63. package/build/lib/useMutation.js +1 -0
  64. package/build/lib/useMutation.js.map +1 -1
  65. package/build/lib/useMutation.mjs +1 -0
  66. package/build/lib/useMutation.mjs.map +1 -1
  67. package/build/lib/useQueries.esm.js +1 -0
  68. package/build/lib/useQueries.esm.js.map +1 -1
  69. package/build/lib/useQueries.js +1 -0
  70. package/build/lib/useQueries.js.map +1 -1
  71. package/build/lib/useQueries.mjs +1 -0
  72. package/build/lib/useQueries.mjs.map +1 -1
  73. package/build/lib/useQuery.esm.js +1 -0
  74. package/build/lib/useQuery.esm.js.map +1 -1
  75. package/build/lib/useQuery.js +1 -0
  76. package/build/lib/useQuery.js.map +1 -1
  77. package/build/lib/useQuery.mjs +1 -0
  78. package/build/lib/useQuery.mjs.map +1 -1
  79. package/build/lib/useSyncExternalStore.esm.js +1 -1
  80. package/build/lib/useSyncExternalStore.esm.js.map +1 -1
  81. package/build/lib/useSyncExternalStore.js +1 -1
  82. package/build/lib/useSyncExternalStore.js.map +1 -1
  83. package/build/lib/useSyncExternalStore.mjs +1 -1
  84. package/build/lib/useSyncExternalStore.mjs.map +1 -1
  85. package/build/umd/index.development.js +6 -5
  86. package/build/umd/index.development.js.map +1 -1
  87. package/build/umd/index.production.js +1 -1
  88. package/build/umd/index.production.js.map +1 -1
  89. package/package.json +2 -2
  90. package/src/errorBoundaryUtils.ts +1 -0
  91. package/src/reactBatchedUpdates.ts +1 -0
  92. package/src/useBaseQuery.ts +1 -0
  93. package/src/useInfiniteQuery.ts +1 -0
  94. package/src/useIsFetching.ts +1 -0
  95. package/src/useIsMutating.ts +1 -0
  96. package/src/useMutation.ts +1 -0
  97. package/src/useQueries.ts +1 -0
  98. package/src/useQuery.ts +1 -0
  99. package/src/useSyncExternalStore.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"useSyncExternalStore.mjs","sources":["../../src/useSyncExternalStore.ts"],"sourcesContent":["// Temporary workaround due to an issue with react-native uSES - https://github.com/TanStack/query/pull/3601\nimport { useSyncExternalStore as uSES } from 'use-sync-external-store/shim/index.js'\n\nexport const useSyncExternalStore = uSES\n"],"names":["useSyncExternalStore","uSES"],"mappings":";;AAAA;AAGO,MAAMA,oBAAoB,GAAGC;;;;"}
1
+ {"version":3,"file":"useSyncExternalStore.mjs","sources":["../../src/useSyncExternalStore.ts"],"sourcesContent":["'use client'\n// Temporary workaround due to an issue with react-native uSES - https://github.com/TanStack/query/pull/3601\nimport { useSyncExternalStore as uSES } from 'use-sync-external-store/shim/index.js'\n\nexport const useSyncExternalStore = uSES\n"],"names":[],"mappings":";;;AAIO;;"}
@@ -2841,9 +2841,10 @@
2841
2841
 
2842
2842
  findMatchingObservers(queries) {
2843
2843
  const prevObservers = this.observers;
2844
+ const prevObserversMap = new Map(prevObservers.map(observer => [observer.options.queryHash, observer]));
2844
2845
  const defaultedQueryOptions = queries.map(options => this.client.defaultQueryOptions(options));
2845
2846
  const matchingObservers = defaultedQueryOptions.flatMap(defaultedOptions => {
2846
- const match = prevObservers.find(observer => observer.options.queryHash === defaultedOptions.queryHash);
2847
+ const match = prevObserversMap.get(defaultedOptions.queryHash);
2847
2848
 
2848
2849
  if (match != null) {
2849
2850
  return [{
@@ -2854,9 +2855,10 @@
2854
2855
 
2855
2856
  return [];
2856
2857
  });
2857
- const matchedQueryHashes = matchingObservers.map(match => match.defaultedQueryOptions.queryHash);
2858
- const unmatchedQueries = defaultedQueryOptions.filter(defaultedOptions => !matchedQueryHashes.includes(defaultedOptions.queryHash));
2859
- const unmatchedObservers = prevObservers.filter(prevObserver => !matchingObservers.some(match => match.observer === prevObserver));
2858
+ const matchedQueryHashes = new Set(matchingObservers.map(match => match.defaultedQueryOptions.queryHash));
2859
+ const unmatchedQueries = defaultedQueryOptions.filter(defaultedOptions => !matchedQueryHashes.has(defaultedOptions.queryHash));
2860
+ const matchingObserversSet = new Set(matchingObservers.map(match => match.observer));
2861
+ const unmatchedObservers = prevObservers.filter(prevObserver => !matchingObserversSet.has(prevObserver));
2860
2862
 
2861
2863
  const getObserver = options => {
2862
2864
  const defaultedOptions = this.client.defaultQueryOptions(options);
@@ -3467,7 +3469,6 @@
3467
3469
  }
3468
3470
  } (shim));
3469
3471
 
3470
- // Temporary workaround due to an issue with react-native uSES - https://github.com/TanStack/query/pull/3601
3471
3472
  const useSyncExternalStore = shim.exports.useSyncExternalStore;
3472
3473
 
3473
3474
  const defaultContext = /*#__PURE__*/React__namespace.createContext(undefined);