@tanstack/query-core 5.24.1 → 5.24.2

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.
Files changed (37) hide show
  1. package/build/legacy/query.cjs +2 -2
  2. package/build/legacy/query.cjs.map +1 -1
  3. package/build/legacy/query.js +2 -2
  4. package/build/legacy/query.js.map +1 -1
  5. package/build/legacy/queryClient.cjs +5 -5
  6. package/build/legacy/queryClient.cjs.map +1 -1
  7. package/build/legacy/queryClient.js +5 -5
  8. package/build/legacy/queryClient.js.map +1 -1
  9. package/build/legacy/queryObserver.cjs +5 -5
  10. package/build/legacy/queryObserver.cjs.map +1 -1
  11. package/build/legacy/queryObserver.js +5 -5
  12. package/build/legacy/queryObserver.js.map +1 -1
  13. package/build/legacy/utils.cjs +2 -2
  14. package/build/legacy/utils.cjs.map +1 -1
  15. package/build/legacy/utils.js +2 -2
  16. package/build/legacy/utils.js.map +1 -1
  17. package/build/modern/query.cjs +2 -2
  18. package/build/modern/query.cjs.map +1 -1
  19. package/build/modern/query.js +2 -2
  20. package/build/modern/query.js.map +1 -1
  21. package/build/modern/queryClient.cjs +5 -5
  22. package/build/modern/queryClient.cjs.map +1 -1
  23. package/build/modern/queryClient.js +5 -5
  24. package/build/modern/queryClient.js.map +1 -1
  25. package/build/modern/queryObserver.cjs +5 -5
  26. package/build/modern/queryObserver.cjs.map +1 -1
  27. package/build/modern/queryObserver.js +5 -5
  28. package/build/modern/queryObserver.js.map +1 -1
  29. package/build/modern/utils.cjs +2 -2
  30. package/build/modern/utils.cjs.map +1 -1
  31. package/build/modern/utils.js +2 -2
  32. package/build/modern/utils.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/query.ts +2 -2
  35. package/src/queryClient.ts +5 -8
  36. package/src/queryObserver.ts +6 -6
  37. package/src/utils.ts +2 -5
@@ -147,7 +147,7 @@ export class QueryObserver<
147
147
  this.options = this.#client.defaultQueryOptions(options)
148
148
 
149
149
  if (
150
- typeof this.options.enabled !== 'undefined' &&
150
+ this.options.enabled !== undefined &&
151
151
  typeof this.options.enabled !== 'boolean'
152
152
  ) {
153
153
  throw new Error('Expected enabled to be a boolean')
@@ -454,7 +454,7 @@ export class QueryObserver<
454
454
  }
455
455
 
456
456
  // Select data if needed
457
- if (options.select && typeof state.data !== 'undefined') {
457
+ if (options.select && state.data !== undefined) {
458
458
  // Memoize select result
459
459
  if (
460
460
  prevResult &&
@@ -481,8 +481,8 @@ export class QueryObserver<
481
481
 
482
482
  // Show placeholder data if needed
483
483
  if (
484
- typeof options.placeholderData !== 'undefined' &&
485
- typeof data === 'undefined' &&
484
+ options.placeholderData !== undefined &&
485
+ data === undefined &&
486
486
  status === 'pending'
487
487
  ) {
488
488
  let placeholderData
@@ -503,7 +503,7 @@ export class QueryObserver<
503
503
  this.#lastQueryWithDefinedData as any,
504
504
  )
505
505
  : options.placeholderData
506
- if (options.select && typeof placeholderData !== 'undefined') {
506
+ if (options.select && placeholderData !== undefined) {
507
507
  try {
508
508
  placeholderData = options.select(placeholderData)
509
509
  this.#selectError = null
@@ -513,7 +513,7 @@ export class QueryObserver<
513
513
  }
514
514
  }
515
515
 
516
- if (typeof placeholderData !== 'undefined') {
516
+ if (placeholderData !== undefined) {
517
517
  status = 'success'
518
518
  data = replaceData(
519
519
  prevResult?.data,
package/src/utils.ts CHANGED
@@ -122,10 +122,7 @@ export function matchQuery(
122
122
  return false
123
123
  }
124
124
 
125
- if (
126
- typeof fetchStatus !== 'undefined' &&
127
- fetchStatus !== query.state.fetchStatus
128
- ) {
125
+ if (fetchStatus && fetchStatus !== query.state.fetchStatus) {
129
126
  return false
130
127
  }
131
128
 
@@ -288,7 +285,7 @@ export function isPlainObject(o: any): o is Object {
288
285
 
289
286
  // If has no constructor
290
287
  const ctor = o.constructor
291
- if (typeof ctor === 'undefined') {
288
+ if (ctor === undefined) {
292
289
  return true
293
290
  }
294
291