Skip to content

Commit

Permalink
chore: message
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo committed Aug 30, 2024
1 parent 93d14ec commit 82d75b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/query-core/src/__tests__/query.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,9 @@ describe('query', () => {
expect(queryFn).toHaveBeenCalledTimes(1)

expect(consoleMock).toHaveBeenCalledWith(
expect.stringContaining('Data is not serializable'),
expect.stringContaining(
'StructuralSharing requires data to be JSON serializable',
),
)

expect(query.state.status).toBe('error')
Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export function replaceData<
JSON.stringify(data)
} catch (error) {
console.error(
`Data is not serializable. [${options.queryHash}]: ${error}; The error will be redacted in production builds`,
`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')
Expand Down

0 comments on commit 82d75b7

Please sign in to comment.