@tanstack/react-query
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ "use client"; | ||
import * as React from "react"; | ||
import { shouldThrowError } from "./utils.js"; | ||
import { shouldThrowError } from "@tanstack/query-core"; | ||
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => { | ||
@@ -8,0 +8,0 @@ if (options.suspense || options.throwOnError || options.experimental_prefetchInRender) { |
@@ -5,5 +5,9 @@ "use client"; | ||
import * as React from "react"; | ||
import { MutationObserver, notifyManager } from "@tanstack/query-core"; | ||
import { | ||
MutationObserver, | ||
notifyManager, | ||
shouldThrowError | ||
} from "@tanstack/query-core"; | ||
import { useQueryClient } from "./QueryClientProvider.js"; | ||
import { noop, shouldThrowError } from "./utils.js"; | ||
import { noop } from "./utils.js"; | ||
function useMutation(options, queryClient) { | ||
@@ -10,0 +14,0 @@ const client = useQueryClient(queryClient); |
@@ -1,4 +0,3 @@ | ||
declare function shouldThrowError<T extends (...args: Array<any>) => boolean>(throwError: boolean | T | undefined, params: Parameters<T>): boolean; | ||
declare function noop(): void; | ||
export { noop, shouldThrowError }; | ||
export { noop }; |
// src/utils.ts | ||
function shouldThrowError(throwError, params) { | ||
if (typeof throwError === "function") { | ||
return throwError(...params); | ||
} | ||
return !!throwError; | ||
} | ||
function noop() { | ||
} | ||
export { | ||
noop, | ||
shouldThrowError | ||
noop | ||
}; | ||
//# sourceMappingURL=utils.js.map |
@@ -5,3 +5,3 @@ "use client"; | ||
import * as React from "react"; | ||
import { shouldThrowError } from "./utils.js"; | ||
import { shouldThrowError } from "@tanstack/query-core"; | ||
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => { | ||
@@ -8,0 +8,0 @@ if (options.suspense || options.throwOnError || options.experimental_prefetchInRender) { |
@@ -5,5 +5,9 @@ "use client"; | ||
import * as React from "react"; | ||
import { MutationObserver, notifyManager } from "@tanstack/query-core"; | ||
import { | ||
MutationObserver, | ||
notifyManager, | ||
shouldThrowError | ||
} from "@tanstack/query-core"; | ||
import { useQueryClient } from "./QueryClientProvider.js"; | ||
import { noop, shouldThrowError } from "./utils.js"; | ||
import { noop } from "./utils.js"; | ||
function useMutation(options, queryClient) { | ||
@@ -10,0 +14,0 @@ const client = useQueryClient(queryClient); |
@@ -1,4 +0,3 @@ | ||
declare function shouldThrowError<T extends (...args: Array<any>) => boolean>(throwError: boolean | T | undefined, params: Parameters<T>): boolean; | ||
declare function noop(): void; | ||
export { noop, shouldThrowError }; | ||
export { noop }; |
// src/utils.ts | ||
function shouldThrowError(throwError, params) { | ||
if (typeof throwError === "function") { | ||
return throwError(...params); | ||
} | ||
return !!throwError; | ||
} | ||
function noop() { | ||
} | ||
export { | ||
noop, | ||
shouldThrowError | ||
noop | ||
}; | ||
//# sourceMappingURL=utils.js.map |
// @ts-check | ||
import vitest from '@vitest/eslint-plugin' | ||
import rootConfig from './root.eslint.config.js' | ||
@@ -12,2 +11,3 @@ | ||
'@typescript-eslint/no-unnecessary-condition': 'off', | ||
'@typescript-eslint/require-await': 'off', | ||
'import/no-duplicates': 'off', | ||
@@ -14,0 +14,0 @@ 'import/no-unresolved': 'off', |
@@ -42,2 +42,3 @@ // @ts-check | ||
'@typescript-eslint/no-unsafe-function-type': 'off', | ||
'@typescript-eslint/require-await': 'error', | ||
'no-case-declarations': 'off', | ||
@@ -44,0 +45,0 @@ }, |
{ | ||
"name": "@tanstack/react-query", | ||
"version": "5.75.5", | ||
"version": "5.75.6", | ||
"description": "Hooks for managing, caching and syncing asynchronous and remote data in React", | ||
@@ -47,3 +47,3 @@ "author": "tannerlinsley", | ||
"dependencies": { | ||
"@tanstack/query-core": "5.75.5" | ||
"@tanstack/query-core": "5.75.6" | ||
}, | ||
@@ -61,3 +61,4 @@ "devDependencies": { | ||
"react-error-boundary": "^4.1.2", | ||
"@tanstack/query-persist-client-core": "5.75.5" | ||
"@tanstack/query-test-utils": "0.0.0", | ||
"@tanstack/query-persist-client-core": "5.75.6" | ||
}, | ||
@@ -64,0 +65,0 @@ "peerDependencies": { |
'use client' | ||
import * as React from 'react' | ||
import { shouldThrowError } from './utils' | ||
import { shouldThrowError } from '@tanstack/query-core' | ||
import type { | ||
@@ -5,0 +5,0 @@ DefaultedQueryObserverOptions, |
'use client' | ||
import * as React from 'react' | ||
import { MutationObserver, notifyManager } from '@tanstack/query-core' | ||
import { | ||
MutationObserver, | ||
notifyManager, | ||
shouldThrowError, | ||
} from '@tanstack/query-core' | ||
import { useQueryClient } from './QueryClientProvider' | ||
import { noop, shouldThrowError } from './utils' | ||
import { noop } from './utils' | ||
import type { | ||
@@ -7,0 +11,0 @@ UseMutateFunction, |
@@ -1,13 +0,1 @@ | ||
export function shouldThrowError<T extends (...args: Array<any>) => boolean>( | ||
throwError: boolean | T | undefined, | ||
params: Parameters<T>, | ||
): boolean { | ||
// Allow throwError function to override throwing behavior on a per-error basis | ||
if (typeof throwError === 'function') { | ||
return throwError(...params) | ||
} | ||
return !!throwError | ||
} | ||
export function noop(): void {} |
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
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
722971
-0.46%12
9.09%8754
-0.33%+ Added
- Removed
Updated