@tanstack/query-core 5.90.8 → 5.90.10

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 (83) hide show
  1. package/build/legacy/{hydration-CyNNBExb.d.cts → hydration-CfvD_Kks.d.cts} +2 -2
  2. package/build/legacy/{hydration-DEHujg3S.d.ts → hydration-DksKBgQq.d.ts} +2 -2
  3. package/build/legacy/hydration.d.cts +1 -1
  4. package/build/legacy/hydration.d.ts +1 -1
  5. package/build/legacy/index.d.cts +1 -1
  6. package/build/legacy/index.d.ts +1 -1
  7. package/build/legacy/infiniteQueryBehavior.d.cts +1 -1
  8. package/build/legacy/infiniteQueryBehavior.d.ts +1 -1
  9. package/build/legacy/infiniteQueryObserver.d.cts +1 -1
  10. package/build/legacy/infiniteQueryObserver.d.ts +1 -1
  11. package/build/legacy/mutation.d.cts +1 -1
  12. package/build/legacy/mutation.d.ts +1 -1
  13. package/build/legacy/mutationCache.d.cts +1 -1
  14. package/build/legacy/mutationCache.d.ts +1 -1
  15. package/build/legacy/mutationObserver.d.cts +1 -1
  16. package/build/legacy/mutationObserver.d.ts +1 -1
  17. package/build/legacy/queriesObserver.d.cts +1 -1
  18. package/build/legacy/queriesObserver.d.ts +1 -1
  19. package/build/legacy/query.d.cts +1 -1
  20. package/build/legacy/query.d.ts +1 -1
  21. package/build/legacy/queryCache.d.cts +1 -1
  22. package/build/legacy/queryCache.d.ts +1 -1
  23. package/build/legacy/queryClient.d.cts +1 -1
  24. package/build/legacy/queryClient.d.ts +1 -1
  25. package/build/legacy/queryObserver.d.cts +1 -1
  26. package/build/legacy/queryObserver.d.ts +1 -1
  27. package/build/legacy/retryer.d.cts +1 -1
  28. package/build/legacy/retryer.d.ts +1 -1
  29. package/build/legacy/streamedQuery.cjs +1 -1
  30. package/build/legacy/streamedQuery.cjs.map +1 -1
  31. package/build/legacy/streamedQuery.d.cts +2 -2
  32. package/build/legacy/streamedQuery.d.ts +2 -2
  33. package/build/legacy/streamedQuery.js +1 -1
  34. package/build/legacy/streamedQuery.js.map +1 -1
  35. package/build/legacy/types.d.cts +1 -1
  36. package/build/legacy/types.d.ts +1 -1
  37. package/build/legacy/utils.cjs.map +1 -1
  38. package/build/legacy/utils.d.cts +1 -1
  39. package/build/legacy/utils.d.ts +1 -1
  40. package/build/legacy/utils.js.map +1 -1
  41. package/build/modern/{hydration-CyNNBExb.d.cts → hydration-CfvD_Kks.d.cts} +2 -2
  42. package/build/modern/{hydration-DEHujg3S.d.ts → hydration-DksKBgQq.d.ts} +2 -2
  43. package/build/modern/hydration.d.cts +1 -1
  44. package/build/modern/hydration.d.ts +1 -1
  45. package/build/modern/index.d.cts +1 -1
  46. package/build/modern/index.d.ts +1 -1
  47. package/build/modern/infiniteQueryBehavior.d.cts +1 -1
  48. package/build/modern/infiniteQueryBehavior.d.ts +1 -1
  49. package/build/modern/infiniteQueryObserver.d.cts +1 -1
  50. package/build/modern/infiniteQueryObserver.d.ts +1 -1
  51. package/build/modern/mutation.d.cts +1 -1
  52. package/build/modern/mutation.d.ts +1 -1
  53. package/build/modern/mutationCache.d.cts +1 -1
  54. package/build/modern/mutationCache.d.ts +1 -1
  55. package/build/modern/mutationObserver.d.cts +1 -1
  56. package/build/modern/mutationObserver.d.ts +1 -1
  57. package/build/modern/queriesObserver.d.cts +1 -1
  58. package/build/modern/queriesObserver.d.ts +1 -1
  59. package/build/modern/query.d.cts +1 -1
  60. package/build/modern/query.d.ts +1 -1
  61. package/build/modern/queryCache.d.cts +1 -1
  62. package/build/modern/queryCache.d.ts +1 -1
  63. package/build/modern/queryClient.d.cts +1 -1
  64. package/build/modern/queryClient.d.ts +1 -1
  65. package/build/modern/queryObserver.d.cts +1 -1
  66. package/build/modern/queryObserver.d.ts +1 -1
  67. package/build/modern/retryer.d.cts +1 -1
  68. package/build/modern/retryer.d.ts +1 -1
  69. package/build/modern/streamedQuery.cjs +1 -1
  70. package/build/modern/streamedQuery.cjs.map +1 -1
  71. package/build/modern/streamedQuery.d.cts +2 -2
  72. package/build/modern/streamedQuery.d.ts +2 -2
  73. package/build/modern/streamedQuery.js +1 -1
  74. package/build/modern/streamedQuery.js.map +1 -1
  75. package/build/modern/types.d.cts +1 -1
  76. package/build/modern/types.d.ts +1 -1
  77. package/build/modern/utils.cjs.map +1 -1
  78. package/build/modern/utils.d.cts +1 -1
  79. package/build/modern/utils.d.ts +1 -1
  80. package/build/modern/utils.js.map +1 -1
  81. package/package.json +1 -1
  82. package/src/streamedQuery.ts +2 -2
  83. package/src/utils.ts +2 -2
@@ -41,7 +41,7 @@ type StreamedQueryParams<TQueryFnData, TData, TQueryKey extends QueryKey> =
41
41
  * Set to `'replace'` to write all data to the cache once the stream ends.
42
42
  * @param reducer - A function to reduce the streamed chunks into the final data.
43
43
  * Defaults to a function that appends chunks to the end of the array.
44
- * @param initialValue - Initial value to be used while the first chunk is being fetched.
44
+ * @param initialValue - Initial value to be used while the first chunk is being fetched, and returned if the stream yields no values.
45
45
  */
46
46
  export function streamedQuery<
47
47
  TQueryFnData = unknown,
@@ -94,6 +94,6 @@ export function streamedQuery<
94
94
  context.client.setQueryData<TData>(context.queryKey, result)
95
95
  }
96
96
 
97
- return context.client.getQueryData(context.queryKey)!
97
+ return context.client.getQueryData(context.queryKey) ?? initialValue
98
98
  }
99
99
  }
package/src/utils.ts CHANGED
@@ -20,7 +20,7 @@ type DropLast<T extends ReadonlyArray<unknown>> = T extends readonly [
20
20
  ...infer R,
21
21
  unknown,
22
22
  ]
23
- ? R
23
+ ? readonly [...R]
24
24
  : never
25
25
 
26
26
  type TuplePrefixes<T extends ReadonlyArray<unknown>> = T extends readonly []
@@ -43,7 +43,7 @@ export interface QueryFilters<TQueryKey extends QueryKey = QueryKey> {
43
43
  /**
44
44
  * Include queries matching this query key
45
45
  */
46
- queryKey?: TuplePrefixes<TQueryKey>
46
+ queryKey?: TQueryKey | TuplePrefixes<TQueryKey>
47
47
  /**
48
48
  * Include or exclude stale queries
49
49
  */