@tanstack/query-core 4.6.0 → 4.6.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.
- package/build/lib/query.esm.js +5 -1
- package/build/lib/query.esm.js.map +1 -1
- package/build/lib/query.js +5 -1
- package/build/lib/query.js.map +1 -1
- package/build/lib/query.mjs +5 -1
- package/build/lib/query.mjs.map +1 -1
- package/build/umd/index.development.js +5 -1
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/query.ts +6 -5
- package/src/tests/query.test.tsx +1 -5
package/package.json
CHANGED
package/src/query.ts
CHANGED
|
@@ -452,11 +452,12 @@ export class Query<
|
|
|
452
452
|
abort: abortController?.abort.bind(abortController),
|
|
453
453
|
onSuccess: (data) => {
|
|
454
454
|
if (typeof data === 'undefined') {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
`Query data cannot be undefined
|
|
458
|
-
)
|
|
459
|
-
|
|
455
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
456
|
+
this.logger.error(
|
|
457
|
+
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`,
|
|
458
|
+
)
|
|
459
|
+
}
|
|
460
|
+
onError(new Error('undefined') as any)
|
|
460
461
|
return
|
|
461
462
|
}
|
|
462
463
|
|
package/src/tests/query.test.tsx
CHANGED
|
@@ -816,11 +816,7 @@ describe('query', () => {
|
|
|
816
816
|
|
|
817
817
|
await sleep(10)
|
|
818
818
|
|
|
819
|
-
const error = new Error(
|
|
820
|
-
`Query data cannot be undefined - affected query key: ${
|
|
821
|
-
observer.getCurrentQuery().queryHash
|
|
822
|
-
}`,
|
|
823
|
-
)
|
|
819
|
+
const error = new Error('undefined')
|
|
824
820
|
|
|
825
821
|
expect(observerResult).toMatchObject({
|
|
826
822
|
isError: true,
|