@octanejs/tanstack-query 0.1.56 → 0.1.58

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/tanstack-query",
3
- "version": "0.1.56",
3
+ "version": "0.1.58",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "engines": {
@@ -43,7 +43,7 @@
43
43
  "@tanstack/query-core": "5.102.8"
44
44
  },
45
45
  "peerDependencies": {
46
- "octane": "^0.5.0"
46
+ "octane": "^0.7.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@tanstack/react-query": "5.102.8",
@@ -59,9 +59,9 @@
59
59
  "@types/react": "^19.2.17",
60
60
  "@types/react-dom": "^19.2.3",
61
61
  "@tanstack/query-persist-client-core": "5.102.8",
62
- "octane": "0.5.0",
63
- "@octanejs/testing-library": "0.1.54",
64
- "@octanejs/react-error-boundary": "0.1.36"
62
+ "octane": "0.7.0",
63
+ "@octanejs/testing-library": "0.1.56",
64
+ "@octanejs/react-error-boundary": "0.1.38"
65
65
  },
66
66
  "scripts": {
67
67
  "test": "vitest run --root ../.. --project tanstack-query --project tanstack-query-adapted --project tanstack-query-adapted-ssr --project tanstack-query-differential --project tanstack-query-ssr",
package/src/internal.ts CHANGED
@@ -94,6 +94,10 @@ interface SuspensePromiseCache {
94
94
  * committed key's promise when publishing its pending cue. A mutable ref would
95
95
  * make that old-key render read the new key's pending promise and show fallback.
96
96
  * Re-renders during the same pending fetch reuse the in-flight promise.
97
+ *
98
+ * `key` must identify the queries this call site suspends on, never only the
99
+ * ones still pending: settling must not change it, or the memo drops the
100
+ * settled promise mid-episode and the call site stops reserving its position.
97
101
  */
98
102
  export function useSuspensePromise(
99
103
  shouldSuspend: boolean,
package/src/useQueries.ts CHANGED
@@ -107,16 +107,21 @@ export function useQueries(options: any, ...rest: any[]): any {
107
107
 
108
108
  // If any query should suspend, await their optimistic fetches as one retained
109
109
  // suspense promise. Retaining it gives a sequential useQueries call the same
110
- // stable replay position as useBaseQuery above.
110
+ // stable replay position as useBaseQuery. The key covers every suspense
111
+ // query, not only the pending ones, so it survives the group settling.
111
112
  const suspenseIndexes: number[] = [];
113
+ const suspenseHashes: string[] = [];
112
114
  for (let index = 0; index < optimisticResult.length; index++) {
113
- if (shouldSuspend(defaultedQueries[index], optimisticResult[index])) {
115
+ const query = defaultedQueries[index];
116
+ if (!query.suspense) continue;
117
+ suspenseHashes.push(query.queryHash);
118
+ if (shouldSuspend(query, optimisticResult[index])) {
114
119
  suspenseIndexes.push(index);
115
120
  }
116
121
  }
117
122
  useSuspensePromise(
118
123
  suspenseIndexes.length > 0,
119
- JSON.stringify(suspenseIndexes.map((index) => defaultedQueries[index].queryHash)),
124
+ JSON.stringify(suspenseHashes),
120
125
  () =>
121
126
  Promise.all(
122
127
  suspenseIndexes.map((index) => {