Skip to content

Commit

Permalink
refactor(*): Import noop function from utils
Browse files Browse the repository at this point in the history
  • Loading branch information
saul-atomrigs committed Feb 24, 2024
1 parent 8104a40 commit c76f36f
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 16 deletions.
3 changes: 1 addition & 2 deletions packages/angular-query-experimental/src/inject-mutation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DestroyRef, computed, effect, inject, signal } from '@angular/core'
import { MutationObserver, notifyManager } from '@tanstack/query-core'
import { noop } from '../../query-core/src/utils'
import { assertInjector } from './util/assert-injector/assert-injector'
import { signalProxy } from './signal-proxy'
import { injectQueryClient } from './inject-query-client'
Expand Down Expand Up @@ -64,5 +65,3 @@ export function injectMutation<
>
})
}

function noop() {}
6 changes: 2 additions & 4 deletions packages/query-async-storage-persister/src/asyncThrottle.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { noop } from '../../query-core/src/utils'

export interface AsyncThrottleOptions {
interval?: number
onError?: (error: unknown) => void
}

const noop = () => {
/* do nothing */
}

export function asyncThrottle<TArgs extends ReadonlyArray<unknown>>(
func: (...args: TArgs) => Promise<void>,
{ interval = 1000, onError = noop }: AsyncThrottleOptions = {},
Expand Down
3 changes: 1 addition & 2 deletions packages/query-async-storage-persister/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { noop } from '../../query-core/src/utils'
import { asyncThrottle } from './asyncThrottle'
import type {
AsyncStorage,
Expand Down Expand Up @@ -99,5 +100,3 @@ export const createAsyncStoragePersister = ({
removeClient: noop,
}
}

function noop() {}
3 changes: 1 addition & 2 deletions packages/query-sync-storage-persister/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { noop } from '../../query-core/src/utils'
import type {
PersistRetryer,
PersistedClient,
Expand Down Expand Up @@ -108,5 +109,3 @@ function throttle<TArgs extends Array<any>>(
}
}
}

function noop() {}
3 changes: 1 addition & 2 deletions packages/react-query/src/useMutation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client'
import * as React from 'react'
import { MutationObserver, notifyManager } from '@tanstack/query-core'
import { noop } from '../../query-core/src/utils'
import { useQueryClient } from './QueryClientProvider'
import { shouldThrowError } from './utils'
import type {
Expand Down Expand Up @@ -63,5 +64,3 @@ export function useMutation<

return { ...result, mutate, mutateAsync: result.mutate }
}

function noop() {}
3 changes: 1 addition & 2 deletions packages/solid-query/src/createMutation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MutationObserver } from '@tanstack/query-core'
import { createComputed, createMemo, on, onCleanup } from 'solid-js'
import { createStore } from 'solid-js/store'
import { noop } from '../../query-core/src/utils'
import { useQueryClient } from './QueryClientProvider'
import { shouldThrowError } from './utils'
import type { DefaultError } from '@tanstack/query-core'
Expand Down Expand Up @@ -74,5 +75,3 @@ export function createMutation<

return state
}

function noop() {}
3 changes: 1 addition & 2 deletions packages/svelte-query/src/createMutation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { derived, get, readable } from 'svelte/store'
import { MutationObserver, notifyManager } from '@tanstack/query-core'
import { noop } from '../../query-core/src/utils'
import { useQueryClient } from './useQueryClient'
import { isSvelteStore } from './utils'
import type {
Expand Down Expand Up @@ -47,5 +48,3 @@ export function createMutation<

return { subscribe }
}

function noop() {}

0 comments on commit c76f36f

Please sign in to comment.