@tanstack/query-core
Advanced tools
Comparing version 5.52.3 to 5.53.1
@@ -259,3 +259,8 @@ import { | ||
} | ||
this.setData(data); | ||
try { | ||
this.setData(data); | ||
} catch (error) { | ||
onError(error); | ||
return; | ||
} | ||
(_b2 = (_a2 = __privateGet(this, _cache).config).onSuccess) == null ? void 0 : _b2.call(_a2, data, this); | ||
@@ -262,0 +267,0 @@ (_d = (_c2 = __privateGet(this, _cache).config).onSettled) == null ? void 0 : _d.call( |
@@ -182,2 +182,13 @@ import "./chunk-2HYBKCYP.js"; | ||
} else if (options.structuralSharing !== false) { | ||
if (process.env.NODE_ENV !== "production") { | ||
try { | ||
JSON.stringify(prevData); | ||
JSON.stringify(data); | ||
} catch (error) { | ||
console.error( | ||
`StructuralSharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}` | ||
); | ||
throw new Error("Data is not serializable"); | ||
} | ||
} | ||
return replaceEqualDeep(prevData, data); | ||
@@ -184,0 +195,0 @@ } |
@@ -241,3 +241,8 @@ // src/query.ts | ||
} | ||
this.setData(data); | ||
try { | ||
this.setData(data); | ||
} catch (error) { | ||
onError(error); | ||
return; | ||
} | ||
this.#cache.config.onSuccess?.(data, this); | ||
@@ -244,0 +249,0 @@ this.#cache.config.onSettled?.( |
@@ -180,2 +180,13 @@ // src/utils.ts | ||
} else if (options.structuralSharing !== false) { | ||
if (process.env.NODE_ENV !== "production") { | ||
try { | ||
JSON.stringify(prevData); | ||
JSON.stringify(data); | ||
} catch (error) { | ||
console.error( | ||
`StructuralSharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}` | ||
); | ||
throw new Error("Data is not serializable"); | ||
} | ||
} | ||
return replaceEqualDeep(prevData, data); | ||
@@ -182,0 +193,0 @@ } |
{ | ||
"name": "@tanstack/query-core", | ||
"version": "5.52.3", | ||
"version": "5.53.1", | ||
"description": "The framework agnostic core that powers TanStack Query", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -502,3 +502,8 @@ import { | ||
this.setData(data) | ||
try { | ||
this.setData(data) | ||
} catch (error) { | ||
onError(error as TError) | ||
return | ||
} | ||
@@ -505,0 +510,0 @@ // Notify cache callback |
@@ -356,2 +356,15 @@ import type { | ||
} else if (options.structuralSharing !== false) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
try { | ||
JSON.stringify(prevData) | ||
JSON.stringify(data) | ||
} catch (error) { | ||
console.error( | ||
`StructuralSharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`, | ||
) | ||
throw new Error('Data is not serializable') | ||
} | ||
} | ||
// Structurally share data between prev and new data if needed | ||
@@ -358,0 +371,0 @@ return replaceEqualDeep(prevData, data) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2029725
28843
11