diff --git a/packages/angular-query-experimental/src/inject-mutation.ts b/packages/angular-query-experimental/src/inject-mutation.ts index 41e47411b2..f4e2334013 100644 --- a/packages/angular-query-experimental/src/inject-mutation.ts +++ b/packages/angular-query-experimental/src/inject-mutation.ts @@ -3,6 +3,7 @@ import { MutationObserver, notifyManager } from '@tanstack/query-core' import { assertInjector } from './util/assert-injector/assert-injector' import { signalProxy } from './signal-proxy' import { injectQueryClient } from './inject-query-client' +import { noop } from './util' import type { DefaultError, QueryClient } from '@tanstack/query-core' import type { Injector } from '@angular/core' @@ -64,5 +65,3 @@ export function injectMutation< > }) } - -function noop() {} diff --git a/packages/angular-query-experimental/src/util/index.ts b/packages/angular-query-experimental/src/util/index.ts new file mode 100644 index 0000000000..177804c7ab --- /dev/null +++ b/packages/angular-query-experimental/src/util/index.ts @@ -0,0 +1 @@ +export function noop() {} diff --git a/packages/query-async-storage-persister/src/asyncThrottle.ts b/packages/query-async-storage-persister/src/asyncThrottle.ts index 8f5157d56e..835c33dfa4 100644 --- a/packages/query-async-storage-persister/src/asyncThrottle.ts +++ b/packages/query-async-storage-persister/src/asyncThrottle.ts @@ -1,12 +1,10 @@ +import { noop } from './utils' + export interface AsyncThrottleOptions { interval?: number onError?: (error: unknown) => void } -const noop = () => { - /* do nothing */ -} - export function asyncThrottle>( func: (...args: TArgs) => Promise, { interval = 1000, onError = noop }: AsyncThrottleOptions = {}, diff --git a/packages/query-async-storage-persister/src/index.ts b/packages/query-async-storage-persister/src/index.ts index 86a11167da..c280294dde 100644 --- a/packages/query-async-storage-persister/src/index.ts +++ b/packages/query-async-storage-persister/src/index.ts @@ -1,4 +1,5 @@ import { asyncThrottle } from './asyncThrottle' +import { noop } from './utils' import type { AsyncStorage, MaybePromise, @@ -99,5 +100,3 @@ export const createAsyncStoragePersister = ({ removeClient: noop, } } - -function noop() {} diff --git a/packages/query-async-storage-persister/src/utils.ts b/packages/query-async-storage-persister/src/utils.ts new file mode 100644 index 0000000000..177804c7ab --- /dev/null +++ b/packages/query-async-storage-persister/src/utils.ts @@ -0,0 +1 @@ +export function noop() {} diff --git a/packages/query-sync-storage-persister/src/index.ts b/packages/query-sync-storage-persister/src/index.ts index 61d9499430..9601fd4bad 100644 --- a/packages/query-sync-storage-persister/src/index.ts +++ b/packages/query-sync-storage-persister/src/index.ts @@ -1,3 +1,4 @@ +import { noop } from './utils' import type { PersistRetryer, PersistedClient, @@ -108,5 +109,3 @@ function throttle>( } } } - -function noop() {} diff --git a/packages/query-sync-storage-persister/src/utils.ts b/packages/query-sync-storage-persister/src/utils.ts new file mode 100644 index 0000000000..177804c7ab --- /dev/null +++ b/packages/query-sync-storage-persister/src/utils.ts @@ -0,0 +1 @@ +export function noop() {} diff --git a/packages/react-query/src/useMutation.ts b/packages/react-query/src/useMutation.ts index deb4dd2580..34edd450a2 100644 --- a/packages/react-query/src/useMutation.ts +++ b/packages/react-query/src/useMutation.ts @@ -2,7 +2,7 @@ import * as React from 'react' import { MutationObserver, notifyManager } from '@tanstack/query-core' import { useQueryClient } from './QueryClientProvider' -import { shouldThrowError } from './utils' +import { noop, shouldThrowError } from './utils' import type { UseMutateFunction, UseMutationOptions, @@ -63,5 +63,3 @@ export function useMutation< return { ...result, mutate, mutateAsync: result.mutate } } - -function noop() {} diff --git a/packages/react-query/src/utils.ts b/packages/react-query/src/utils.ts index b3a928ff6b..d07a9316fe 100644 --- a/packages/react-query/src/utils.ts +++ b/packages/react-query/src/utils.ts @@ -9,3 +9,5 @@ export function shouldThrowError) => boolean>( return !!throwError } + +export function noop() {} diff --git a/packages/solid-query/src/createMutation.ts b/packages/solid-query/src/createMutation.ts index 37bf04091c..39c56ff2e3 100644 --- a/packages/solid-query/src/createMutation.ts +++ b/packages/solid-query/src/createMutation.ts @@ -2,7 +2,7 @@ import { MutationObserver } from '@tanstack/query-core' import { createComputed, createMemo, on, onCleanup } from 'solid-js' import { createStore } from 'solid-js/store' import { useQueryClient } from './QueryClientProvider' -import { shouldThrowError } from './utils' +import { noop, shouldThrowError } from './utils' import type { DefaultError } from '@tanstack/query-core' import type { QueryClient } from './QueryClient' import type { @@ -74,5 +74,3 @@ export function createMutation< return state } - -function noop() {} diff --git a/packages/solid-query/src/utils.ts b/packages/solid-query/src/utils.ts index b3a928ff6b..d07a9316fe 100644 --- a/packages/solid-query/src/utils.ts +++ b/packages/solid-query/src/utils.ts @@ -9,3 +9,5 @@ export function shouldThrowError) => boolean>( return !!throwError } + +export function noop() {} diff --git a/packages/svelte-query/src/createMutation.ts b/packages/svelte-query/src/createMutation.ts index 99fcf21117..5997d8b2f0 100644 --- a/packages/svelte-query/src/createMutation.ts +++ b/packages/svelte-query/src/createMutation.ts @@ -1,7 +1,7 @@ import { derived, get, readable } from 'svelte/store' import { MutationObserver, notifyManager } from '@tanstack/query-core' import { useQueryClient } from './useQueryClient' -import { isSvelteStore } from './utils' +import { isSvelteStore, noop } from './utils' import type { CreateMutateFunction, CreateMutationOptions, @@ -47,5 +47,3 @@ export function createMutation< return { subscribe } } - -function noop() {} diff --git a/packages/svelte-query/src/utils.ts b/packages/svelte-query/src/utils.ts index eb86225694..617144fae0 100644 --- a/packages/svelte-query/src/utils.ts +++ b/packages/svelte-query/src/utils.ts @@ -6,3 +6,5 @@ export function isSvelteStore( ): obj is Readable { return 'subscribe' in obj && typeof obj.subscribe === 'function' } + +export function noop() {}