diff --git a/packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx b/packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
index 0274e4db3c..164a387d40 100644
--- a/packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
+++ b/packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
@@ -15,7 +15,7 @@ const createMockPersister = (): Persister => {
let storedState: PersistedClient | undefined
return {
- async persistClient(persistClient: PersistedClient) {
+ persistClient(persistClient: PersistedClient) {
storedState = persistClient
},
async restoreClient() {
diff --git a/packages/solid-query/src/__tests__/useMutation.test.tsx b/packages/solid-query/src/__tests__/useMutation.test.tsx
index 3a80e4b45f..4c23bf383e 100644
--- a/packages/solid-query/src/__tests__/useMutation.test.tsx
+++ b/packages/solid-query/src/__tests__/useMutation.test.tsx
@@ -316,11 +316,11 @@ describe('useMutation', () => {
function Page() {
const mutation = useMutation(() => ({
- mutationFn: async (text: string) => text,
- onSuccess: async () => {
+ mutationFn: (text: string) => Promise.resolve(text),
+ onSuccess: () => {
callbacks.push('useMutation.onSuccess')
},
- onSettled: async () => {
+ onSettled: () => {
callbacks.push('useMutation.onSettled')
},
}))
@@ -330,10 +330,10 @@ describe('useMutation', () => {
setActTimeout(async () => {
try {
const result = await mutateAsync('todo', {
- onSuccess: async () => {
+ onSuccess: () => {
callbacks.push('mutateAsync.onSuccess')
},
- onSettled: async () => {
+ onSettled: () => {
callbacks.push('mutateAsync.onSettled')
},
})
@@ -369,10 +369,10 @@ describe('useMutation', () => {
const mutation = useMutation(() => ({
mutationFn: async (_text: string) => Promise.reject(new Error('oops')),
- onError: async () => {
+ onError: () => {
callbacks.push('useMutation.onError')
},
- onSettled: async () => {
+ onSettled: () => {
callbacks.push('useMutation.onSettled')
},
}))
@@ -382,10 +382,10 @@ describe('useMutation', () => {
setActTimeout(async () => {
try {
await mutateAsync('todo', {
- onError: async () => {
+ onError: () => {
callbacks.push('mutateAsync.onError')
},
- onSettled: async () => {
+ onSettled: () => {
callbacks.push('mutateAsync.onSettled')
},
})
@@ -756,7 +756,7 @@ describe('useMutation', () => {
})
})
- it('should not change state if unmounted', async () => {
+ it('should not change state if unmounted', () => {
function Mutates() {
const mutation = useMutation(() => ({ mutationFn: () => sleep(10) }))
return
@@ -901,11 +901,11 @@ describe('useMutation', () => {
function Page() {
const mutationSucceed = useMutation(() => ({
- mutationFn: async () => '',
+ mutationFn: () => Promise.resolve(''),
meta: { metaSuccessMessage },
}))
const mutationError = useMutation(() => ({
- mutationFn: async () => {
+ mutationFn: () => {
throw new Error('')
},
meta: { metaErrorMessage },
diff --git a/packages/solid-query/src/__tests__/useQueries.test.tsx b/packages/solid-query/src/__tests__/useQueries.test.tsx
index 46ee666d42..fcdae15d84 100644
--- a/packages/solid-query/src/__tests__/useQueries.test.tsx
+++ b/packages/solid-query/src/__tests__/useQueries.test.tsx
@@ -69,7 +69,7 @@ describe('useQueries', () => {
expect(results[2]).toMatchObject([{ data: 1 }, { data: 2 }])
})
- it('handles type parameter - tuple of tuples', async () => {
+ it('handles type parameter - tuple of tuples', () => {
const key1 = queryKey()
const key2 = queryKey()
const key3 = queryKey()
@@ -174,7 +174,7 @@ describe('useQueries', () => {
}
})
- it('handles type parameter - tuple of objects', async () => {
+ it('handles type parameter - tuple of objects', () => {
const key1 = queryKey()
const key2 = queryKey()
const key3 = queryKey()
@@ -315,7 +315,7 @@ describe('useQueries', () => {
}
})
- it('handles array literal without type parameter to infer result type', async () => {
+ it('handles array literal without type parameter to infer result type', () => {
const key1 = queryKey()
const key2 = queryKey()
const key3 = queryKey()
@@ -544,7 +544,7 @@ describe('useQueries', () => {
type QueryKeyA = ['queryA']
const getQueryKeyA = (): QueryKeyA => ['queryA']
type GetQueryFunctionA = () => QueryFunction
- const getQueryFunctionA: GetQueryFunctionA = () => async () => {
+ const getQueryFunctionA: GetQueryFunctionA = () => () => {
return 1
}
type SelectorA = (data: number) => [number, string]
@@ -553,7 +553,7 @@ describe('useQueries', () => {
type QueryKeyB = ['queryB', string]
const getQueryKeyB = (id: string): QueryKeyB => ['queryB', id]
type GetQueryFunctionB = () => QueryFunction
- const getQueryFunctionB: GetQueryFunctionB = () => async () => {
+ const getQueryFunctionB: GetQueryFunctionB = () => () => {
return '1'
}
type SelectorB = (data: string) => [string, number]
diff --git a/packages/solid-query/src/__tests__/useQuery.test.tsx b/packages/solid-query/src/__tests__/useQuery.test.tsx
index 70914603b7..7a1547bf45 100644
--- a/packages/solid-query/src/__tests__/useQuery.test.tsx
+++ b/packages/solid-query/src/__tests__/useQuery.test.tsx
@@ -72,7 +72,7 @@ describe('useQuery', () => {
// it should provide the result type in the configuration
useQuery(() => ({
queryKey: [key],
- queryFn: async () => true,
+ queryFn: () => true,
}))
// it should be possible to specify a union type as result type
@@ -117,7 +117,7 @@ describe('useQuery', () => {
type MyData = number
type MyQueryKey = readonly ['my-data', number]
- const getMyDataArrayKey: QueryFunction = async ({
+ const getMyDataArrayKey: QueryFunction = ({
queryKey: [, n],
}) => {
return n + 42
@@ -128,9 +128,7 @@ describe('useQuery', () => {
queryFn: getMyDataArrayKey,
}))
- const getMyDataStringKey: QueryFunction = async (
- context,
- ) => {
+ const getMyDataStringKey: QueryFunction = (context) => {
expectTypeOf(context.queryKey).toEqualTypeOf<['1']>()
return Number(context.queryKey[0]) + 42
}
@@ -170,7 +168,7 @@ describe('useQuery', () => {
queryFn: () => fetcher(qk[1], 'token'),
...options,
}))
- const test = useWrappedQuery([''], async () => '1')
+ const test = useWrappedQuery([''], () => Promise.resolve('1'))
expectTypeOf(test.data).toEqualTypeOf()
// handles wrapped queries with custom fetcher passed directly to useQuery
@@ -188,7 +186,9 @@ describe('useQuery', () => {
'safely'
>,
) => useQuery(() => ({ queryKey: qk, queryFn: fetcher, ...options }))
- const testFuncStyle = useWrappedFuncStyleQuery([''], async () => true)
+ const testFuncStyle = useWrappedFuncStyleQuery([''], () =>
+ Promise.resolve(true),
+ )
expectTypeOf(testFuncStyle.data).toEqualTypeOf()
}
})
@@ -1854,7 +1854,7 @@ describe('useQuery', () => {
})
// See https://github.com/tannerlinsley/react-query/issues/137
- it('should not override initial data in dependent queries', async () => {
+ it('should not override initial data in dependent queries', () => {
const key1 = queryKey()
const key2 = queryKey()
@@ -1895,7 +1895,7 @@ describe('useQuery', () => {
rendered.getByText('Second Status: success')
})
- it('should update query options', async () => {
+ it('should update query options', () => {
const key = queryKey()
const queryFn = async () => {
@@ -2018,7 +2018,7 @@ describe('useQuery', () => {
})
// See https://github.com/tannerlinsley/react-query/issues/144
- it('should be in "pending" state by default', async () => {
+ it('should be in "pending" state by default', () => {
const key = queryKey()
function Page() {
@@ -3403,7 +3403,7 @@ describe('useQuery', () => {
const query = useQuery(() => ({
queryKey: key,
- queryFn: async () => {
+ queryFn: () => {
if (counter < 2) {
counter++
throw new Error('error')
@@ -3753,7 +3753,7 @@ describe('useQuery', () => {
expect(results[2]).toMatchObject({ data: 'fetched data', isStale: false })
})
- it('should support enabled:false in query object syntax', async () => {
+ it('should support enabled:false in query object syntax', () => {
const key = queryKey()
const queryFn = vi.fn<(...args: Array) => string>()
queryFn.mockImplementation(() => 'data')
@@ -5916,7 +5916,7 @@ describe('useQuery', () => {
const states: Array> = []
const error = new Error('oops')
- const queryFn = async (): Promise => {
+ const queryFn = (): Promise => {
throw error
}
@@ -5996,7 +5996,7 @@ describe('useQuery', () => {
function Page() {
const state = useQuery(() => ({
queryKey: key,
- queryFn: async (): Promise => {
+ queryFn: (): Promise => {
throw error
},
retry: false,