@tanstack/vue-query 4.35.6 → 4.36.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.
|
@@ -3239,18 +3239,23 @@
|
|
|
3239
3239
|
mutationKey: dehydratedMutation.mutationKey
|
|
3240
3240
|
}, dehydratedMutation.state);
|
|
3241
3241
|
});
|
|
3242
|
-
queries.forEach(
|
|
3242
|
+
queries.forEach(({
|
|
3243
|
+
queryKey,
|
|
3244
|
+
state,
|
|
3245
|
+
queryHash
|
|
3246
|
+
}) => {
|
|
3243
3247
|
var _options$defaultOptio2;
|
|
3244
3248
|
|
|
3245
|
-
const query = queryCache.get(
|
|
3246
|
-
// query being stuck in fetching state upon hydration
|
|
3247
|
-
|
|
3248
|
-
const dehydratedQueryState = { ...dehydratedQuery.state,
|
|
3249
|
-
fetchStatus: 'idle'
|
|
3250
|
-
}; // Do not hydrate if an existing query exists with newer data
|
|
3249
|
+
const query = queryCache.get(queryHash); // Do not hydrate if an existing query exists with newer data
|
|
3251
3250
|
|
|
3252
3251
|
if (query) {
|
|
3253
|
-
if (query.state.dataUpdatedAt <
|
|
3252
|
+
if (query.state.dataUpdatedAt < state.dataUpdatedAt) {
|
|
3253
|
+
// omit fetchStatus from dehydrated state
|
|
3254
|
+
// so that query stays in its current fetchStatus
|
|
3255
|
+
const {
|
|
3256
|
+
fetchStatus: _ignored,
|
|
3257
|
+
...dehydratedQueryState
|
|
3258
|
+
} = state;
|
|
3254
3259
|
query.setState(dehydratedQueryState);
|
|
3255
3260
|
}
|
|
3256
3261
|
|
|
@@ -3259,9 +3264,13 @@
|
|
|
3259
3264
|
|
|
3260
3265
|
|
|
3261
3266
|
queryCache.build(client, { ...(options == null ? void 0 : (_options$defaultOptio2 = options.defaultOptions) == null ? void 0 : _options$defaultOptio2.queries),
|
|
3262
|
-
queryKey
|
|
3263
|
-
queryHash
|
|
3264
|
-
},
|
|
3267
|
+
queryKey,
|
|
3268
|
+
queryHash
|
|
3269
|
+
}, // Reset fetch status to idle to avoid
|
|
3270
|
+
// query being stuck in fetching state upon hydration
|
|
3271
|
+
{ ...state,
|
|
3272
|
+
fetchStatus: 'idle'
|
|
3273
|
+
});
|
|
3265
3274
|
});
|
|
3266
3275
|
}
|
|
3267
3276
|
|