diff --git a/packages/query-core/src/utils.ts b/packages/query-core/src/utils.ts index bcc35239f1..8adc59049e 100644 --- a/packages/query-core/src/utils.ts +++ b/packages/query-core/src/utils.ts @@ -373,6 +373,9 @@ export function replaceData< console.error( `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`, ) + + // Prevent the replaceEqualDeep from being called again down below. + throw error } } // Structurally share data between prev and new data if needed