Socket
Socket
Sign inDemoInstall

@tanstack/query-core

Package Overview
Dependencies
Maintainers
2
Versions
266
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/query-core - npm Package Compare versions

Comparing version 5.24.5 to 5.24.6

8

build/legacy/query.js

@@ -82,6 +82,6 @@ import {

isStale() {
return this.state.isInvalidated || !this.state.dataUpdatedAt || __privateGet(this, _observers).some((observer) => observer.getCurrentResult().isStale);
return this.state.isInvalidated || this.state.data === void 0 || __privateGet(this, _observers).some((observer) => observer.getCurrentResult().isStale);
}
isStaleByTime(staleTime = 0) {
return this.state.isInvalidated || !this.state.dataUpdatedAt || !timeUntilStale(this.state.dataUpdatedAt, staleTime);
return this.state.isInvalidated || this.state.data === void 0 || !timeUntilStale(this.state.dataUpdatedAt, staleTime);
}

@@ -134,3 +134,3 @@ onFocus() {

if (this.state.fetchStatus !== "idle") {
if (this.state.dataUpdatedAt && (fetchOptions == null ? void 0 : fetchOptions.cancelRefetch)) {
if (this.state.data !== void 0 && (fetchOptions == null ? void 0 : fetchOptions.cancelRefetch)) {
this.cancel({ silent: true });

@@ -318,3 +318,3 @@ } else if (__privateGet(this, _promise)) {

fetchStatus: canFetch(this.options.networkMode) ? "fetching" : "paused",
...!state.dataUpdatedAt && {
...state.data === void 0 && {
error: null,

@@ -321,0 +321,0 @@ status: "pending"

@@ -197,3 +197,3 @@ import {

fetchStatus = canFetch(query.options.networkMode) ? "fetching" : "paused";
if (!state.dataUpdatedAt) {
if (state.data === void 0) {
status = "pending";

@@ -261,2 +261,3 @@ }

const isLoading = isPending && isFetching;
const hasData = state.data !== void 0;
const result = {

@@ -281,6 +282,6 @@ status,

isRefetching: isFetching && !isPending,
isLoadingError: isError && state.dataUpdatedAt === 0,
isLoadingError: isError && !hasData,
isPaused: fetchStatus === "paused",
isPlaceholderData,
isRefetchError: isError && state.dataUpdatedAt !== 0,
isRefetchError: isError && hasData,
isStale: isStale(query, options),

@@ -445,6 +446,6 @@ refetch: this.refetch

function shouldLoadOnMount(query, options) {
return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === "error" && options.retryOnMount === false);
return options.enabled !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
}
function shouldFetchOnMount(query, options) {
return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);
return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
}

@@ -451,0 +452,0 @@ function shouldFetchOn(query, options, field) {

@@ -75,6 +75,6 @@ // src/query.ts

isStale() {
return this.state.isInvalidated || !this.state.dataUpdatedAt || this.#observers.some((observer) => observer.getCurrentResult().isStale);
return this.state.isInvalidated || this.state.data === void 0 || this.#observers.some((observer) => observer.getCurrentResult().isStale);
}
isStaleByTime(staleTime = 0) {
return this.state.isInvalidated || !this.state.dataUpdatedAt || !timeUntilStale(this.state.dataUpdatedAt, staleTime);
return this.state.isInvalidated || this.state.data === void 0 || !timeUntilStale(this.state.dataUpdatedAt, staleTime);
}

@@ -124,3 +124,3 @@ onFocus() {

if (this.state.fetchStatus !== "idle") {
if (this.state.dataUpdatedAt && fetchOptions?.cancelRefetch) {
if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {
this.cancel({ silent: true });

@@ -288,3 +288,3 @@ } else if (this.#promise) {

fetchStatus: canFetch(this.options.networkMode) ? "fetching" : "paused",
...!state.dataUpdatedAt && {
...state.data === void 0 && {
error: null,

@@ -291,0 +291,0 @@ status: "pending"

@@ -237,3 +237,3 @@ // src/queryObserver.ts

fetchStatus = canFetch(query.options.networkMode) ? "fetching" : "paused";
if (!state.dataUpdatedAt) {
if (state.data === void 0) {
status = "pending";

@@ -301,2 +301,3 @@ }

const isLoading = isPending && isFetching;
const hasData = state.data !== void 0;
const result = {

@@ -321,6 +322,6 @@ status,

isRefetching: isFetching && !isPending,
isLoadingError: isError && state.dataUpdatedAt === 0,
isLoadingError: isError && !hasData,
isPaused: fetchStatus === "paused",
isPlaceholderData,
isRefetchError: isError && state.dataUpdatedAt !== 0,
isRefetchError: isError && hasData,
isStale: isStale(query, options),

@@ -404,6 +405,6 @@ refetch: this.refetch

function shouldLoadOnMount(query, options) {
return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === "error" && options.retryOnMount === false);
return options.enabled !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
}
function shouldFetchOnMount(query, options) {
return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);
return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
}

@@ -410,0 +411,0 @@ function shouldFetchOn(query, options, field) {

{
"name": "@tanstack/query-core",
"version": "5.24.5",
"version": "5.24.6",
"description": "The framework agnostic core that powers TanStack Query",

@@ -5,0 +5,0 @@ "author": "tannerlinsley",

@@ -253,3 +253,3 @@ import { noop, replaceData, timeUntilStale } from './utils'

this.state.isInvalidated ||
!this.state.dataUpdatedAt ||
this.state.data === undefined ||
this.#observers.some((observer) => observer.getCurrentResult().isStale)

@@ -262,3 +262,3 @@ )

this.state.isInvalidated ||
!this.state.dataUpdatedAt ||
this.state.data === undefined ||
!timeUntilStale(this.state.dataUpdatedAt, staleTime)

@@ -334,3 +334,3 @@ )

if (this.state.fetchStatus !== 'idle') {
if (this.state.dataUpdatedAt && fetchOptions?.cancelRefetch) {
if (this.state.data !== undefined && fetchOptions?.cancelRefetch) {
// Silently cancel current fetch if the user wants to cancel refetch

@@ -552,3 +552,3 @@ this.cancel({ silent: true })

: 'paused',
...(!state.dataUpdatedAt && {
...(state.data === undefined && {
error: null,

@@ -555,0 +555,0 @@ status: 'pending',

@@ -447,3 +447,3 @@ import {

: 'paused'
if (!state.dataUpdatedAt) {
if (state.data === undefined) {
status = 'pending'

@@ -540,2 +540,3 @@ }

const isLoading = isPending && isFetching
const hasData = state.data !== undefined

@@ -563,6 +564,6 @@ const result: QueryObserverBaseResult<TData, TError> = {

isRefetching: isFetching && !isPending,
isLoadingError: isError && state.dataUpdatedAt === 0,
isLoadingError: isError && !hasData,
isPaused: fetchStatus === 'paused',
isPlaceholderData,
isRefetchError: isError && state.dataUpdatedAt !== 0,
isRefetchError: isError && hasData,
isStale: isStale(query, options),

@@ -689,3 +690,3 @@ refetch: this.refetch,

options.enabled !== false &&
!query.state.dataUpdatedAt &&
query.state.data === undefined &&
!(query.state.status === 'error' && options.retryOnMount === false)

@@ -701,3 +702,3 @@ )

shouldLoadOnMount(query, options) ||
(query.state.dataUpdatedAt > 0 &&
(query.state.data !== undefined &&
shouldFetchOn(query, options, options.refetchOnMount))

@@ -704,0 +705,0 @@ )

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc