@tanstack/solid-query 5.51.1 → 5.51.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.cts CHANGED
@@ -214,4 +214,4 @@ declare function createQueries<T extends Array<any>, TCombinedResult extends Que
214
214
  declare const useIsRestoring: () => Accessor<boolean>;
215
215
  declare const IsRestoringProvider: solid_js.ContextProviderComponent<Accessor<boolean>>;
216
216
 
217
- export { type CreateBaseMutationResult, type CreateBaseQueryOptions, type CreateBaseQueryResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreateMutateAsyncFunction, type CreateMutateFunction, type CreateMutationOptions, type CreateMutationResult, type CreateQueryOptions, type CreateQueryResult, type DefaultOptions, type DefinedCreateBaseQueryResult, type DefinedCreateInfiniteQueryResult, type DefinedCreateQueryResult, type DefinedInitialDataInfiniteOptions, type FunctionedParams, type InfiniteQueryObserverOptions, IsRestoringProvider, QueryClient, type QueryClientConfig, QueryClientContext, QueryClientProvider, type QueryClientProviderProps, type QueryObserverOptions, type SolidInfiniteQueryOptions, type SolidMutationOptions, type SolidQueryOptions, type UndefinedInitialDataInfiniteOptions, createInfiniteQuery, createMutation, createQueries, createQuery, infiniteQueryOptions, queryOptions, useIsFetching, useIsMutating, useIsRestoring, useMutationState, useQueryClient };
217
+ export { type CreateBaseMutationResult, type CreateBaseQueryOptions, type CreateBaseQueryResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreateMutateAsyncFunction, type CreateMutateFunction, type CreateMutationOptions, type CreateMutationResult, type CreateQueryOptions, type CreateQueryResult, type DefaultOptions, type DefinedCreateBaseQueryResult, type DefinedCreateInfiniteQueryResult, type DefinedCreateQueryResult, type DefinedInitialDataInfiniteOptions, type DefinedInitialDataOptions, type FunctionedParams, type InfiniteQueryObserverOptions, IsRestoringProvider, QueryClient, type QueryClientConfig, QueryClientContext, QueryClientProvider, type QueryClientProviderProps, type QueryObserverOptions, type SolidInfiniteQueryOptions, type SolidMutationOptions, type SolidQueryOptions, type UndefinedInitialDataInfiniteOptions, type UndefinedInitialDataOptions, createInfiniteQuery, createMutation, createQueries, createQuery, infiniteQueryOptions, queryOptions, useIsFetching, useIsMutating, useIsRestoring, useMutationState, useQueryClient };
package/build/index.d.ts CHANGED
@@ -214,4 +214,4 @@ declare function createQueries<T extends Array<any>, TCombinedResult extends Que
214
214
  declare const useIsRestoring: () => Accessor<boolean>;
215
215
  declare const IsRestoringProvider: solid_js.ContextProviderComponent<Accessor<boolean>>;
216
216
 
217
- export { type CreateBaseMutationResult, type CreateBaseQueryOptions, type CreateBaseQueryResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreateMutateAsyncFunction, type CreateMutateFunction, type CreateMutationOptions, type CreateMutationResult, type CreateQueryOptions, type CreateQueryResult, type DefaultOptions, type DefinedCreateBaseQueryResult, type DefinedCreateInfiniteQueryResult, type DefinedCreateQueryResult, type DefinedInitialDataInfiniteOptions, type FunctionedParams, type InfiniteQueryObserverOptions, IsRestoringProvider, QueryClient, type QueryClientConfig, QueryClientContext, QueryClientProvider, type QueryClientProviderProps, type QueryObserverOptions, type SolidInfiniteQueryOptions, type SolidMutationOptions, type SolidQueryOptions, type UndefinedInitialDataInfiniteOptions, createInfiniteQuery, createMutation, createQueries, createQuery, infiniteQueryOptions, queryOptions, useIsFetching, useIsMutating, useIsRestoring, useMutationState, useQueryClient };
217
+ export { type CreateBaseMutationResult, type CreateBaseQueryOptions, type CreateBaseQueryResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreateMutateAsyncFunction, type CreateMutateFunction, type CreateMutationOptions, type CreateMutationResult, type CreateQueryOptions, type CreateQueryResult, type DefaultOptions, type DefinedCreateBaseQueryResult, type DefinedCreateInfiniteQueryResult, type DefinedCreateQueryResult, type DefinedInitialDataInfiniteOptions, type DefinedInitialDataOptions, type FunctionedParams, type InfiniteQueryObserverOptions, IsRestoringProvider, QueryClient, type QueryClientConfig, QueryClientContext, QueryClientProvider, type QueryClientProviderProps, type QueryObserverOptions, type SolidInfiniteQueryOptions, type SolidMutationOptions, type SolidQueryOptions, type UndefinedInitialDataInfiniteOptions, type UndefinedInitialDataOptions, createInfiniteQuery, createMutation, createQueries, createQuery, infiniteQueryOptions, queryOptions, useIsFetching, useIsMutating, useIsRestoring, useMutationState, useQueryClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/solid-query",
3
- "version": "5.51.1",
3
+ "version": "5.51.3",
4
4
  "description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  "src"
45
45
  ],
46
46
  "dependencies": {
47
- "@tanstack/query-core": "5.51.1"
47
+ "@tanstack/query-core": "5.51.3"
48
48
  },
49
49
  "devDependencies": {
50
50
  "tsup-preset-solid": "^2.2.0",
@@ -1100,11 +1100,10 @@ describe('useInfiniteQuery', () => {
1100
1100
  it('should silently cancel an ongoing fetchNextPage request when another fetchNextPage is invoked', async () => {
1101
1101
  const key = queryKey()
1102
1102
  const start = 10
1103
- const onAborts: Array<Mock<any, any>> = []
1104
- const abortListeners: Array<Mock<any, any>> = []
1103
+ const onAborts: Array<Mock<(...args: Array<any>) => any>> = []
1104
+ const abortListeners: Array<Mock<(...args: Array<any>) => any>> = []
1105
1105
  const fetchPage = vi.fn<
1106
- [QueryFunctionContext<typeof key, number>],
1107
- Promise<number>
1106
+ (context: QueryFunctionContext<typeof key, number>) => Promise<number>
1108
1107
  >(async ({ pageParam, signal }) => {
1109
1108
  const onAbort = vi.fn()
1110
1109
  const abortListener = vi.fn()
@@ -1182,11 +1181,10 @@ describe('useInfiniteQuery', () => {
1182
1181
  it('should not cancel an ongoing fetchNextPage request when another fetchNextPage is invoked if `cancelRefetch: false` is used ', async () => {
1183
1182
  const key = queryKey()
1184
1183
  const start = 10
1185
- const onAborts: Array<Mock<any, any>> = []
1186
- const abortListeners: Array<Mock<any, any>> = []
1184
+ const onAborts: Array<Mock<(...args: Array<any>) => any>> = []
1185
+ const abortListeners: Array<Mock<(...args: Array<any>) => any>> = []
1187
1186
  const fetchPage = vi.fn<
1188
- [QueryFunctionContext<typeof key, number>],
1189
- Promise<number>
1187
+ (context: QueryFunctionContext<typeof key, number>) => Promise<number>
1190
1188
  >(async ({ pageParam, signal }) => {
1191
1189
  const onAbort = vi.fn()
1192
1190
  const abortListener = vi.fn()
@@ -180,7 +180,7 @@ describe('createMutation', () => {
180
180
  const [count, setCount] = createSignal(0)
181
181
  type Value = { count: number }
182
182
 
183
- const mutateFn = vi.fn<[value: Value], Promise<Value>>()
183
+ const mutateFn = vi.fn<(value: Value) => Promise<Value>>()
184
184
 
185
185
  mutateFn.mockImplementationOnce(() => {
186
186
  return Promise.reject(new Error('Error test Jonas'))
@@ -2044,7 +2044,9 @@ describe('createQuery', () => {
2044
2044
 
2045
2045
  it('should not refetch query on focus when `enabled` is set to `false`', async () => {
2046
2046
  const key = queryKey()
2047
- const queryFn = vi.fn<Array<unknown>, string>().mockReturnValue('data')
2047
+ const queryFn = vi
2048
+ .fn<(...args: Array<unknown>) => string>()
2049
+ .mockReturnValue('data')
2048
2050
 
2049
2051
  function Page() {
2050
2052
  const { data = 'default' } = createQuery(() => ({
@@ -3021,7 +3023,7 @@ describe('createQuery', () => {
3021
3023
  it('should retry specified number of times', async () => {
3022
3024
  const key = queryKey()
3023
3025
 
3024
- const queryFn = vi.fn<Array<unknown>, unknown>()
3026
+ const queryFn = vi.fn<(...args: Array<unknown>) => unknown>()
3025
3027
  queryFn.mockImplementation(() => {
3026
3028
  return Promise.reject(new Error('Error test Barrett'))
3027
3029
  })
@@ -3062,7 +3064,7 @@ describe('createQuery', () => {
3062
3064
  it('should not retry if retry function `false`', async () => {
3063
3065
  const key = queryKey()
3064
3066
 
3065
- const queryFn = vi.fn<Array<unknown>, unknown>()
3067
+ const queryFn = vi.fn<(...args: Array<unknown>) => unknown>()
3066
3068
 
3067
3069
  queryFn.mockImplementationOnce(() => {
3068
3070
  return Promise.reject(new Error('Error test Tanner'))
@@ -3110,7 +3112,7 @@ describe('createQuery', () => {
3110
3112
 
3111
3113
  type DelayError = { delay: number }
3112
3114
 
3113
- const queryFn = vi.fn<Array<unknown>, unknown>()
3115
+ const queryFn = vi.fn<(...args: Array<unknown>) => unknown>()
3114
3116
  queryFn.mockImplementation(() => {
3115
3117
  return Promise.reject({ delay: 50 })
3116
3118
  })
@@ -3321,10 +3323,10 @@ describe('createQuery', () => {
3321
3323
  const key = queryKey()
3322
3324
  const states: Array<CreateQueryResult<string>> = []
3323
3325
 
3324
- const queryFn = vi.fn<Array<unknown>, string>()
3326
+ const queryFn = vi.fn<(...args: Array<unknown>) => string>()
3325
3327
  queryFn.mockImplementation(() => 'data')
3326
3328
 
3327
- const prefetchQueryFn = vi.fn<Array<unknown>, string>()
3329
+ const prefetchQueryFn = vi.fn<(...args: Array<unknown>) => string>()
3328
3330
  prefetchQueryFn.mockImplementation(() => 'not yet...')
3329
3331
 
3330
3332
  await queryClient.prefetchQuery({
@@ -3358,10 +3360,11 @@ describe('createQuery', () => {
3358
3360
  it('should not refetch if not stale after a prefetch', async () => {
3359
3361
  const key = queryKey()
3360
3362
 
3361
- const queryFn = vi.fn<Array<unknown>, string>()
3363
+ const queryFn = vi.fn<(...args: Array<unknown>) => string>()
3362
3364
  queryFn.mockImplementation(() => 'data')
3363
3365
 
3364
- const prefetchQueryFn = vi.fn<Array<unknown>, Promise<string>>()
3366
+ const prefetchQueryFn =
3367
+ vi.fn<(...args: Array<unknown>) => Promise<string>>()
3365
3368
  prefetchQueryFn.mockImplementation(async () => {
3366
3369
  await sleep(10)
3367
3370
  return 'not yet...'
@@ -3635,7 +3638,7 @@ describe('createQuery', () => {
3635
3638
 
3636
3639
  it('it should support enabled:false in query object syntax', async () => {
3637
3640
  const key = queryKey()
3638
- const queryFn = vi.fn<Array<unknown>, string>()
3641
+ const queryFn = vi.fn<(...args: Array<unknown>) => string>()
3639
3642
  queryFn.mockImplementation(() => 'data')
3640
3643
 
3641
3644
  function Page() {
@@ -3745,7 +3748,9 @@ describe('createQuery', () => {
3745
3748
 
3746
3749
  it('should not cause memo churn when data does not change', async () => {
3747
3750
  const key = queryKey()
3748
- const queryFn = vi.fn<Array<unknown>, string>().mockReturnValue('data')
3751
+ const queryFn = vi
3752
+ .fn<(...args: Array<unknown>) => string>()
3753
+ .mockReturnValue('data')
3749
3754
  const memoFn = vi.fn()
3750
3755
 
3751
3756
  function Page() {
@@ -3981,7 +3986,9 @@ describe('createQuery', () => {
3981
3986
  it('should refetch if any query instance becomes enabled', async () => {
3982
3987
  const key = queryKey()
3983
3988
 
3984
- const queryFn = vi.fn<Array<unknown>, string>().mockReturnValue('data')
3989
+ const queryFn = vi
3990
+ .fn<(...args: Array<unknown>) => string>()
3991
+ .mockReturnValue('data')
3985
3992
 
3986
3993
  function Disabled() {
3987
3994
  createQuery(() => ({ queryKey: key, queryFn, enabled: false }))
@@ -4730,7 +4737,7 @@ describe('createQuery', () => {
4730
4737
  })
4731
4738
 
4732
4739
  it('should refetch when changed enabled to true in error state', async () => {
4733
- const queryFn = vi.fn<Array<unknown>, unknown>()
4740
+ const queryFn = vi.fn<(...args: Array<unknown>) => unknown>()
4734
4741
  queryFn.mockImplementation(async () => {
4735
4742
  await sleep(10)
4736
4743
  return Promise.reject(new Error('Suspense Error Bingo'))
@@ -145,7 +145,7 @@ describe("useQuery's in Suspense mode", () => {
145
145
  it('should not call the queryFn twice when used in Suspense mode', async () => {
146
146
  const key = queryKey()
147
147
 
148
- const queryFn = vi.fn<Array<unknown>, string>()
148
+ const queryFn = vi.fn<(...args: Array<unknown>) => string>()
149
149
  queryFn.mockImplementation(() => {
150
150
  sleep(10)
151
151
  return 'data'
@@ -661,7 +661,7 @@ describe("useQuery's in Suspense mode", () => {
661
661
  it('should not call the queryFn when not enabled', async () => {
662
662
  const key = queryKey()
663
663
 
664
- const queryFn = vi.fn<Array<unknown>, Promise<string>>()
664
+ const queryFn = vi.fn<(...args: Array<unknown>) => Promise<string>>()
665
665
  queryFn.mockImplementation(async () => {
666
666
  await sleep(10)
667
667
  return '23'
@@ -4,7 +4,7 @@ import { onlineManager } from '@tanstack/query-core'
4
4
  import { QueryClient } from '../QueryClient'
5
5
  import type { QueryClientConfig } from '..'
6
6
  import type { ParentProps } from 'solid-js'
7
- import type { SpyInstance } from 'vitest'
7
+ import type { MockInstance } from 'vitest'
8
8
 
9
9
  let queryKeyCount = 0
10
10
  export function queryKey() {
@@ -38,13 +38,13 @@ export function createQueryClient(config?: QueryClientConfig): QueryClient {
38
38
 
39
39
  export function mockVisibilityState(
40
40
  value: DocumentVisibilityState,
41
- ): SpyInstance<[], DocumentVisibilityState> {
41
+ ): MockInstance<() => DocumentVisibilityState> {
42
42
  return vi.spyOn(document, 'visibilityState', 'get').mockReturnValue(value)
43
43
  }
44
44
 
45
45
  export function mockOnlineManagerIsOnline(
46
46
  value: boolean,
47
- ): SpyInstance<[], boolean> {
47
+ ): MockInstance<() => boolean> {
48
48
  return vi.spyOn(onlineManager, 'isOnline').mockReturnValue(value)
49
49
  }
50
50
 
@@ -12,7 +12,7 @@ import type {
12
12
  SolidQueryOptions,
13
13
  } from './types'
14
14
 
15
- type UndefinedInitialDataOptions<
15
+ export type UndefinedInitialDataOptions<
16
16
  TQueryFnData = unknown,
17
17
  TError = DefaultError,
18
18
  TData = TQueryFnData,
@@ -23,7 +23,7 @@ type UndefinedInitialDataOptions<
23
23
  }
24
24
  >
25
25
 
26
- type DefinedInitialDataOptions<
26
+ export type DefinedInitialDataOptions<
27
27
  TQueryFnData = unknown,
28
28
  TError = DefaultError,
29
29
  TData = TQueryFnData,
package/src/index.ts CHANGED
@@ -13,6 +13,10 @@ export type {
13
13
  InfiniteQueryObserverOptions,
14
14
  } from './QueryClient'
15
15
  export { createQuery, queryOptions } from './createQuery'
16
+ export type {
17
+ DefinedInitialDataOptions,
18
+ UndefinedInitialDataOptions,
19
+ } from './createQuery'
16
20
  export {
17
21
  QueryClientContext,
18
22
  QueryClientProvider,