@tanstack/query-core 4.41.0 → 4.43.0

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 (52) hide show
  1. package/build/lib/focusManager.d.ts.map +1 -0
  2. package/build/lib/hydration.d.ts.map +1 -0
  3. package/build/lib/index.d.ts.map +1 -0
  4. package/build/lib/infiniteQueryBehavior.d.ts.map +1 -0
  5. package/build/lib/infiniteQueryObserver.d.ts.map +1 -0
  6. package/build/lib/logger.d.ts.map +1 -0
  7. package/build/lib/logger.native.d.ts.map +1 -0
  8. package/build/lib/mutation.d.ts.map +1 -0
  9. package/build/lib/mutationCache.d.ts.map +1 -0
  10. package/build/lib/mutationObserver.d.ts.map +1 -0
  11. package/build/lib/notifyManager.d.ts.map +1 -0
  12. package/build/lib/onlineManager.d.ts.map +1 -0
  13. package/build/lib/queriesObserver.d.ts.map +1 -0
  14. package/build/lib/query.d.ts.map +1 -0
  15. package/build/lib/queryCache.d.ts.map +1 -0
  16. package/build/lib/queryClient.d.ts.map +1 -0
  17. package/build/lib/queryObserver.d.ts.map +1 -0
  18. package/build/lib/removable.d.ts.map +1 -0
  19. package/build/lib/retryer.d.ts.map +1 -0
  20. package/build/lib/subscribable.d.ts.map +1 -0
  21. package/build/lib/tests/focusManager.test.d.ts.map +1 -0
  22. package/build/lib/tests/hydration.test.d.ts.map +1 -0
  23. package/build/lib/tests/infiniteQueryBehavior.test.d.ts.map +1 -0
  24. package/build/lib/tests/infiniteQueryObserver.test.d.ts.map +1 -0
  25. package/build/lib/tests/mutationCache.test.d.ts.map +1 -0
  26. package/build/lib/tests/mutationObserver.test.d.ts.map +1 -0
  27. package/build/lib/tests/mutations.test.d.ts.map +1 -0
  28. package/build/lib/tests/notifyManager.test.d.ts.map +1 -0
  29. package/build/lib/tests/onlineManager.test.d.ts.map +1 -0
  30. package/build/lib/tests/queriesObserver.test.d.ts.map +1 -0
  31. package/build/lib/tests/query.test.d.ts.map +1 -0
  32. package/build/lib/tests/queryCache.test.d.ts.map +1 -0
  33. package/build/lib/tests/queryClient.test.d.ts.map +1 -0
  34. package/build/lib/tests/queryClient.types.test.d.ts.map +1 -0
  35. package/build/lib/tests/queryObserver.test.d.ts.map +1 -0
  36. package/build/lib/tests/utils.d.ts.map +1 -0
  37. package/build/lib/tests/utils.test.d.ts.map +1 -0
  38. package/build/lib/types.d.ts.map +1 -0
  39. package/build/lib/utils.d.ts +1 -1
  40. package/build/lib/utils.d.ts.map +1 -0
  41. package/build/lib/utils.esm.js +3 -2
  42. package/build/lib/utils.esm.js.map +1 -1
  43. package/build/lib/utils.js +3 -2
  44. package/build/lib/utils.js.map +1 -1
  45. package/build/lib/utils.mjs +3 -2
  46. package/build/lib/utils.mjs.map +1 -1
  47. package/build/umd/index.development.js +3 -2
  48. package/build/umd/index.development.js.map +1 -1
  49. package/build/umd/index.production.js +1 -1
  50. package/build/umd/index.production.js.map +1 -1
  51. package/package.json +9 -2
  52. package/src/utils.ts +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/query-core",
3
- "version": "4.41.0",
3
+ "version": "4.43.0",
4
4
  "description": "The framework agnostic core that powers TanStack Query",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -31,5 +31,12 @@
31
31
  "build/umd/*",
32
32
  "src"
33
33
  ],
34
- "scripts": {}
34
+ "scripts": {
35
+ "clean": "rimraf ./build",
36
+ "test:eslint": "eslint --ext .ts,.tsx ./src",
37
+ "test:types": "tsc",
38
+ "test:lib": "jest --config ./jest.config.ts",
39
+ "test:lib:dev": "pnpm run test:lib --watch",
40
+ "build:types": "tsc --build"
41
+ }
35
42
  }
package/src/utils.ts CHANGED
@@ -310,12 +310,14 @@ export function partialDeepEqual(a: any, b: any): boolean {
310
310
  * If not, it will replace any deeply equal children of `b` with those of `a`.
311
311
  * This can be used for structural sharing between JSON values for example.
312
312
  */
313
- export function replaceEqualDeep<T>(a: unknown, b: T): T
314
- export function replaceEqualDeep(a: any, b: any): any {
313
+ export function replaceEqualDeep<T>(a: unknown, b: T, depth?: number): T
314
+ export function replaceEqualDeep(a: any, b: any, depth = 0): any {
315
315
  if (a === b) {
316
316
  return a
317
317
  }
318
318
 
319
+ if (depth > 500) return b
320
+
319
321
  const array = isPlainArray(a) && isPlainArray(b)
320
322
 
321
323
  if (array || (isPlainObject(a) && isPlainObject(b))) {
@@ -328,7 +330,7 @@ export function replaceEqualDeep(a: any, b: any): any {
328
330
 
329
331
  for (let i = 0; i < bSize; i++) {
330
332
  const key = array ? i : bItems[i]
331
- copy[key] = replaceEqualDeep(a[key], b[key])
333
+ copy[key] = replaceEqualDeep(a[key], b[key], depth + 1)
332
334
  if (copy[key] === a[key]) {
333
335
  equalItems++
334
336
  }