Skip to content

Commit a923146

Browse files
committed
remove async
1 parent 9ad919a commit a923146

File tree

13 files changed

+39
-39
lines changed

13 files changed

+39
-39
lines changed

packages/angular-query-experimental/src/__tests__/inject-is-mutating.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('injectIsMutating', () => {
3131
vi.useRealTimers()
3232
})
3333

34-
test('should properly return isMutating state', async () => {
34+
test('should properly return isMutating state', () => {
3535
TestBed.runInInjectionContext(() => {
3636
const isMutating = injectIsMutating()
3737
const mutation = injectMutation(() => ({

packages/angular-query-experimental/src/__tests__/inject-mutation.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ describe('injectMutation', () => {
120120
})
121121
})
122122

123-
test('reactive options should update mutation', async () => {
123+
test('reactive options should update mutation', () => {
124124
const mutationCache = queryClient.getMutationCache()
125125
// Signal will be updated before the mutation is called
126126
// this test confirms that the mutation uses the updated value

packages/angular-query-experimental/src/__tests__/inject-query.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ describe('injectQuery', () => {
232232
...options,
233233
}))
234234
const fromWrappedQuery = TestBed.runInInjectionContext(() =>
235-
createWrappedQuery([''], async () => '1'),
235+
createWrappedQuery([''], () => Promise.resolve('1')),
236236
)
237237
expectTypeOf(fromWrappedQuery.data()).toEqualTypeOf<string | undefined>()
238238

@@ -252,7 +252,7 @@ describe('injectQuery', () => {
252252
>,
253253
) => injectQuery(() => ({ queryKey: qk, queryFn: fetcher, ...options }))
254254
const fromWrappedFuncStyleQuery = TestBed.runInInjectionContext(() =>
255-
createWrappedFuncStyleQuery([''], async () => true),
255+
createWrappedFuncStyleQuery([''], () => Promise.resolve(true)),
256256
)
257257
expectTypeOf(fromWrappedFuncStyleQuery.data()).toEqualTypeOf<
258258
boolean | undefined

packages/query-codemods/src/v4/__testfixtures__/default-import.input.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export const Examples = () => {
2727
queryClient.getQueryDefaults('todos')
2828
queryClient.getQueryState('todos')
2929
queryClient.isFetching('todos')
30-
queryClient.setMutationDefaults('todos', { mutationFn: async () => null })
30+
queryClient.setMutationDefaults('todos', { mutationFn: () => null })
3131
queryClient.setQueriesData('todos', () => null)
3232
queryClient.setQueryData('todos', () => null)
33-
queryClient.setQueryDefaults('todos', { queryFn: async () => null })
33+
queryClient.setQueryDefaults('todos', { queryFn: () => null })
3434
queryClient.cancelQueries('todos')
3535
queryClient.fetchInfiniteQuery('todos')
3636
queryClient.fetchQuery('todos')
@@ -48,11 +48,11 @@ export const Examples = () => {
4848
useQueryClient().getQueryState('todos')
4949
useQueryClient().isFetching('todos')
5050
useQueryClient().setMutationDefaults('todos', {
51-
mutationFn: async () => null,
51+
mutationFn: () => null,
5252
})
5353
useQueryClient().setQueriesData('todos', () => null)
5454
useQueryClient().setQueryData('todos', () => null)
55-
useQueryClient().setQueryDefaults('todos', { queryFn: async () => null })
55+
useQueryClient().setQueryDefaults('todos', { queryFn: () => null })
5656
useQueryClient().cancelQueries('todos')
5757
useQueryClient().fetchInfiniteQuery('todos')
5858
useQueryClient().fetchQuery('todos')

packages/query-codemods/src/v4/__testfixtures__/default-import.output.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ export const Examples = () => {
2929
queryClient.getQueryDefaults(['todos'])
3030
queryClient.getQueryState(['todos'])
3131
queryClient.isFetching(['todos'])
32-
queryClient.setMutationDefaults(['todos'], { mutationFn: async () => null })
32+
queryClient.setMutationDefaults(['todos'], { mutationFn: () => null })
3333
queryClient.setQueriesData(['todos'], () => null)
3434
queryClient.setQueryData(['todos'], () => null)
35-
queryClient.setQueryDefaults(['todos'], { queryFn: async () => null })
35+
queryClient.setQueryDefaults(['todos'], { queryFn: () => null })
3636
queryClient.cancelQueries(['todos'])
3737
queryClient.fetchInfiniteQuery(['todos'])
3838
queryClient.fetchQuery(['todos'])
@@ -50,11 +50,11 @@ export const Examples = () => {
5050
useQueryClient().getQueryState(['todos'])
5151
useQueryClient().isFetching(['todos'])
5252
useQueryClient().setMutationDefaults(['todos'], {
53-
mutationFn: async () => null,
53+
mutationFn: () => null,
5454
})
5555
useQueryClient().setQueriesData(['todos'], () => null)
5656
useQueryClient().setQueryData(['todos'], () => null)
57-
useQueryClient().setQueryDefaults(['todos'], { queryFn: async () => null })
57+
useQueryClient().setQueryDefaults(['todos'], { queryFn: () => null })
5858
useQueryClient().cancelQueries(['todos'])
5959
useQueryClient().fetchInfiniteQuery(['todos'])
6060
useQueryClient().fetchQuery(['todos'])

packages/query-codemods/src/v4/__testfixtures__/named-import.input.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export const Examples = () => {
2727
queryClient.getQueryDefaults('todos')
2828
queryClient.getQueryState('todos')
2929
queryClient.isFetching('todos')
30-
queryClient.setMutationDefaults('todos', { mutationFn: async () => null })
30+
queryClient.setMutationDefaults('todos', { mutationFn: () => null })
3131
queryClient.setQueriesData('todos', () => null)
3232
queryClient.setQueryData('todos', () => null)
33-
queryClient.setQueryDefaults('todos', { queryFn: async () => null })
33+
queryClient.setQueryDefaults('todos', { queryFn: () => null })
3434
queryClient.cancelQueries('todos')
3535
queryClient.fetchInfiniteQuery('todos')
3636
queryClient.fetchQuery('todos')
@@ -48,12 +48,12 @@ export const Examples = () => {
4848
useRenamedQueryClient().getQueryState('todos')
4949
useRenamedQueryClient().isFetching('todos')
5050
useRenamedQueryClient().setMutationDefaults('todos', {
51-
mutationFn: async () => null,
51+
mutationFn: () => null,
5252
})
5353
useRenamedQueryClient().setQueriesData('todos', () => null)
5454
useRenamedQueryClient().setQueryData('todos', () => null)
5555
useRenamedQueryClient().setQueryDefaults('todos', {
56-
queryFn: async () => null,
56+
queryFn: () => null,
5757
})
5858
useRenamedQueryClient().cancelQueries('todos')
5959
useRenamedQueryClient().fetchInfiniteQuery('todos')

packages/query-codemods/src/v4/__testfixtures__/named-import.output.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ export const Examples = () => {
2929
queryClient.getQueryDefaults(['todos'])
3030
queryClient.getQueryState(['todos'])
3131
queryClient.isFetching(['todos'])
32-
queryClient.setMutationDefaults(['todos'], { mutationFn: async () => null })
32+
queryClient.setMutationDefaults(['todos'], { mutationFn: () => null })
3333
queryClient.setQueriesData(['todos'], () => null)
3434
queryClient.setQueryData(['todos'], () => null)
35-
queryClient.setQueryDefaults(['todos'], { queryFn: async () => null })
35+
queryClient.setQueryDefaults(['todos'], { queryFn: () => null })
3636
queryClient.cancelQueries(['todos'])
3737
queryClient.fetchInfiniteQuery(['todos'])
3838
queryClient.fetchQuery(['todos'])
@@ -50,12 +50,12 @@ export const Examples = () => {
5050
useRenamedQueryClient().getQueryState(['todos'])
5151
useRenamedQueryClient().isFetching(['todos'])
5252
useRenamedQueryClient().setMutationDefaults(['todos'], {
53-
mutationFn: async () => null,
53+
mutationFn: () => null,
5454
})
5555
useRenamedQueryClient().setQueriesData(['todos'], () => null)
5656
useRenamedQueryClient().setQueryData(['todos'], () => null)
5757
useRenamedQueryClient().setQueryDefaults(['todos'], {
58-
queryFn: async () => null,
58+
queryFn: () => null,
5959
})
6060
useRenamedQueryClient().cancelQueries(['todos'])
6161
useRenamedQueryClient().fetchInfiniteQuery(['todos'])

packages/query-codemods/src/v4/__testfixtures__/namespaced-import.input.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ export const Examples = () => {
1717
queryClient.getQueryDefaults('todos')
1818
queryClient.getQueryState('todos')
1919
queryClient.isFetching('todos')
20-
queryClient.setMutationDefaults('todos', { mutationFn: async () => null })
20+
queryClient.setMutationDefaults('todos', { mutationFn: () => null })
2121
queryClient.setQueriesData('todos', () => null)
2222
queryClient.setQueryData('todos', () => null)
23-
queryClient.setQueryDefaults('todos', { queryFn: async () => null })
23+
queryClient.setQueryDefaults('todos', { queryFn: () => null })
2424
queryClient.cancelQueries('todos')
2525
queryClient.fetchInfiniteQuery('todos')
2626
queryClient.fetchQuery('todos')
@@ -38,12 +38,12 @@ export const Examples = () => {
3838
RQ.useQueryClient().getQueryState('todos')
3939
RQ.useQueryClient().isFetching('todos')
4040
RQ.useQueryClient().setMutationDefaults('todos', {
41-
mutationFn: async () => null,
41+
mutationFn: () => null,
4242
})
4343
RQ.useQueryClient().setQueriesData('todos', () => null)
4444
RQ.useQueryClient().setQueryData('todos', () => null)
4545
RQ.useQueryClient().setQueryDefaults('todos', {
46-
queryFn: async () => null,
46+
queryFn: () => null,
4747
})
4848
RQ.useQueryClient().cancelQueries('todos')
4949
RQ.useQueryClient().fetchInfiniteQuery('todos')

packages/query-codemods/src/v4/__testfixtures__/namespaced-import.output.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ export const Examples = () => {
1919
queryClient.getQueryDefaults(['todos'])
2020
queryClient.getQueryState(['todos'])
2121
queryClient.isFetching(['todos'])
22-
queryClient.setMutationDefaults(['todos'], { mutationFn: async () => null })
22+
queryClient.setMutationDefaults(['todos'], { mutationFn: () => null })
2323
queryClient.setQueriesData(['todos'], () => null)
2424
queryClient.setQueryData(['todos'], () => null)
25-
queryClient.setQueryDefaults(['todos'], { queryFn: async () => null })
25+
queryClient.setQueryDefaults(['todos'], { queryFn: () => null })
2626
queryClient.cancelQueries(['todos'])
2727
queryClient.fetchInfiniteQuery(['todos'])
2828
queryClient.fetchQuery(['todos'])
@@ -40,12 +40,12 @@ export const Examples = () => {
4040
RQ.useQueryClient().getQueryState(['todos'])
4141
RQ.useQueryClient().isFetching(['todos'])
4242
RQ.useQueryClient().setMutationDefaults(['todos'], {
43-
mutationFn: async () => null,
43+
mutationFn: () => null,
4444
})
4545
RQ.useQueryClient().setQueriesData(['todos'], () => null)
4646
RQ.useQueryClient().setQueryData(['todos'], () => null)
4747
RQ.useQueryClient().setQueryDefaults(['todos'], {
48-
queryFn: async () => null,
48+
queryFn: () => null,
4949
})
5050
RQ.useQueryClient().cancelQueries(['todos'])
5151
RQ.useQueryClient().fetchInfiniteQuery(['todos'])

packages/query-codemods/src/v5/remove-overloads/__testfixtures__/bug-reports.input.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function useDetailsContainsIdentifierAsThirdArgument({ groupId }: { group
2121
export function useWhatever({ thing }: { thing: string }) {
2222
return useQuery(
2323
['some-string', someVar],
24-
async () => 'foo',
24+
() => Promise.resolve('foo'),
2525
{ enabled: Boolean(thing) },
2626
);
2727
}

packages/query-codemods/src/v5/remove-overloads/__testfixtures__/bug-reports.output.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function useDetailsContainsIdentifierAsThirdArgument({ groupId }: { group
2727
export function useWhatever({ thing }: { thing: string }) {
2828
return useQuery({
2929
queryKey: ['some-string', someVar],
30-
queryFn: async () => 'foo',
30+
queryFn: () => Promise.resolve('foo'),
3131
enabled: Boolean(thing)
3232
});
3333
}

packages/query-devtools/src/__tests__/utils.test.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { deleteNestedDataByPath, updateNestedDataByPath } from '../utils'
44
describe('Utils tests', () => {
55
describe('updatedNestedDataByPath', () => {
66
describe('array', () => {
7-
it('should update data correctly', async () => {
7+
it('should update data correctly', () => {
88
const oldData = ['one', 'two', 'three']
99

1010
const newData = updateNestedDataByPath(oldData, ['1'], 'new')
@@ -29,7 +29,7 @@ describe('Utils tests', () => {
2929
})
3030

3131
describe('object', () => {
32-
it('should update data correctly', async () => {
32+
it('should update data correctly', () => {
3333
const oldData = { title: 'Hello world', id: 1, createdAt: '2021-01-01' }
3434

3535
const newData = updateNestedDataByPath(
@@ -58,7 +58,7 @@ describe('Utils tests', () => {
5858
})
5959

6060
describe('set', () => {
61-
it('should update data correctly', async () => {
61+
it('should update data correctly', () => {
6262
const oldData = new Set([123, 321, 'hello', 'world'])
6363

6464
const newData = updateNestedDataByPath(oldData, ['2'], 'hi')
@@ -85,7 +85,7 @@ describe('Utils tests', () => {
8585
})
8686

8787
describe('map', () => {
88-
it('should update data correctly', async () => {
88+
it('should update data correctly', () => {
8989
const oldData = new Map([
9090
['en', 'hello'],
9191
['fr', 'bonjour'],
@@ -113,7 +113,7 @@ describe('Utils tests', () => {
113113
})
114114

115115
describe('nested data', () => {
116-
it('should update data correctly', async () => {
116+
it('should update data correctly', () => {
117117
/* eslint-disable cspell/spellchecker */
118118
const oldData = new Map([
119119
[
@@ -377,7 +377,7 @@ describe('Utils tests', () => {
377377
})
378378

379379
describe('deleteNestedDataByPath', () => {
380-
it('should delete item from array correctly', async () => {
380+
it('should delete item from array correctly', () => {
381381
const oldData = ['one', 'two', 'three']
382382

383383
const newData = deleteNestedDataByPath(oldData, ['1'])
@@ -399,7 +399,7 @@ describe('Utils tests', () => {
399399
`)
400400
})
401401

402-
it('should delete item from object correctly', async () => {
402+
it('should delete item from object correctly', () => {
403403
const oldData = { title: 'Hello world', id: 1, createdAt: '2021-01-01' }
404404

405405
const newData = deleteNestedDataByPath(oldData, ['createdAt'])
@@ -472,7 +472,7 @@ describe('Utils tests', () => {
472472
})
473473

474474
describe('nested data', () => {
475-
it('should delete nested items correctly', async () => {
475+
it('should delete nested items correctly', () => {
476476
/* eslint-disable cspell/spellchecker */
477477
const oldData = new Map([
478478
[

packages/query-persist-client-core/src/__tests__/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function createMockPersister(): Persister {
1717
let storedState: PersistedClient | undefined
1818

1919
return {
20-
async persistClient(persistClient: PersistedClient) {
20+
persistClient(persistClient: PersistedClient) {
2121
storedState = persistClient
2222
},
2323
async restoreClient() {

0 commit comments

Comments
 (0)