@tanstack/svelte-query 6.1.48 → 6.2.1

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.
Files changed (50) hide show
  1. package/dist/context.d.ts +27 -2
  2. package/dist/context.d.ts.map +1 -1
  3. package/dist/context.js +27 -2
  4. package/dist/createInfiniteQuery.d.ts +97 -1
  5. package/dist/createInfiniteQuery.d.ts.map +1 -1
  6. package/dist/createMutation.svelte.d.ts +156 -2
  7. package/dist/createMutation.svelte.d.ts.map +1 -1
  8. package/dist/createMutation.svelte.js +156 -2
  9. package/dist/createQueries.svelte.d.ts +71 -0
  10. package/dist/createQueries.svelte.d.ts.map +1 -1
  11. package/dist/createQueries.svelte.js +71 -0
  12. package/dist/createQuery.d.ts +209 -0
  13. package/dist/createQuery.d.ts.map +1 -1
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/infiniteQueryOptions.d.ts +95 -2
  17. package/dist/infiniteQueryOptions.d.ts.map +1 -1
  18. package/dist/mutationOptions.d.ts +52 -0
  19. package/dist/mutationOptions.d.ts.map +1 -1
  20. package/dist/queryOptions.d.ts +73 -0
  21. package/dist/queryOptions.d.ts.map +1 -1
  22. package/dist/types.d.ts +3 -1
  23. package/dist/types.d.ts.map +1 -1
  24. package/dist/useHydrate.d.ts +28 -0
  25. package/dist/useHydrate.d.ts.map +1 -1
  26. package/dist/useHydrate.js +28 -0
  27. package/dist/useIsFetching.svelte.d.ts +35 -0
  28. package/dist/useIsFetching.svelte.d.ts.map +1 -1
  29. package/dist/useIsFetching.svelte.js +35 -0
  30. package/dist/useIsMutating.svelte.d.ts +23 -0
  31. package/dist/useIsMutating.svelte.d.ts.map +1 -1
  32. package/dist/useIsMutating.svelte.js +23 -0
  33. package/dist/useMutationState.svelte.d.ts +70 -0
  34. package/dist/useMutationState.svelte.d.ts.map +1 -1
  35. package/dist/useMutationState.svelte.js +70 -0
  36. package/package.json +3 -3
  37. package/src/context.ts +27 -2
  38. package/src/createInfiniteQuery.ts +143 -2
  39. package/src/createMutation.svelte.ts +156 -2
  40. package/src/createQueries.svelte.ts +71 -0
  41. package/src/createQuery.ts +209 -0
  42. package/src/index.ts +4 -0
  43. package/src/infiniteQueryOptions.ts +162 -4
  44. package/src/mutationOptions.ts +53 -0
  45. package/src/queryOptions.ts +73 -0
  46. package/src/types.ts +7 -0
  47. package/src/useHydrate.ts +28 -0
  48. package/src/useIsFetching.svelte.ts +35 -0
  49. package/src/useIsMutating.svelte.ts +23 -0
  50. package/src/useMutationState.svelte.ts +70 -0
package/dist/context.d.ts CHANGED
@@ -1,8 +1,33 @@
1
1
  import type { QueryClient } from '@tanstack/query-core';
2
2
  import type { Box } from './containers.svelte';
3
- /** Retrieves a Client from Svelte's context */
3
+ /**
4
+ * Retrieves the `QueryClient` set on Svelte's context by `QueryClientProvider` (or by
5
+ * {@link setQueryClientContext} directly). This is what {@link useQueryClient} calls internally.
6
+ *
7
+ * @throws If no `QueryClient` was found in context.
8
+ * @returns The `QueryClient` set on context, whether by `QueryClientProvider` or {@link setQueryClientContext}.
9
+ */
4
10
  export declare const getQueryClientContext: () => QueryClient;
5
- /** Sets a QueryClient on Svelte's context */
11
+ /**
12
+ * Sets a `QueryClient` on Svelte's context, so it can be read with {@link getQueryClientContext} (or
13
+ * {@link useQueryClient}) from any descendant component. `QueryClientProvider` wraps this — use it directly
14
+ * only if you need to set the client from your own component instead.
15
+ *
16
+ * @param client - The `QueryClient` to make available to descendant components.
17
+ *
18
+ * @example
19
+ * ```svelte
20
+ * <script lang="ts">
21
+ * import { QueryClient, QueryClientProvider } from '@tanstack/svelte-query'
22
+ *
23
+ * const queryClient = new QueryClient()
24
+ * </script>
25
+ *
26
+ * <QueryClientProvider client={queryClient}>
27
+ * ...
28
+ * </QueryClientProvider>
29
+ * ```
30
+ */
6
31
  export declare const setQueryClientContext: (client: QueryClient) => void;
7
32
  /** Retrieves a `isRestoring` from Svelte's context */
8
33
  export declare const getIsRestoringContext: () => Box<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAI9C,+CAA+C;AAC/C,eAAO,MAAM,qBAAqB,QAAO,WASxC,CAAA;AAED,6CAA6C;AAC7C,eAAO,MAAM,qBAAqB,GAAI,QAAQ,WAAW,KAAG,IAE3D,CAAA;AAID,sDAAsD;AACtD,eAAO,MAAM,qBAAqB,QAAO,GAAG,CAAC,OAAO,CASnD,CAAA;AAED,+CAA+C;AAC/C,eAAO,MAAM,qBAAqB,GAAI,aAAa,GAAG,CAAC,OAAO,CAAC,KAAG,IAEjE,CAAA"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AAI9C;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,QAAO,WASxC,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,WAAW,KAAG,IAE3D,CAAA;AAID,sDAAsD;AACtD,eAAO,MAAM,qBAAqB,QAAO,GAAG,CAAC,OAAO,CASnD,CAAA;AAED,+CAA+C;AAC/C,eAAO,MAAM,qBAAqB,GAAI,aAAa,GAAG,CAAC,OAAO,CAAC,KAAG,IAEjE,CAAA"}
package/dist/context.js CHANGED
@@ -1,6 +1,12 @@
1
1
  import { getContext, setContext } from 'svelte';
2
2
  const _contextKey = Symbol('QueryClient');
3
- /** Retrieves a Client from Svelte's context */
3
+ /**
4
+ * Retrieves the `QueryClient` set on Svelte's context by `QueryClientProvider` (or by
5
+ * {@link setQueryClientContext} directly). This is what {@link useQueryClient} calls internally.
6
+ *
7
+ * @throws If no `QueryClient` was found in context.
8
+ * @returns The `QueryClient` set on context, whether by `QueryClientProvider` or {@link setQueryClientContext}.
9
+ */
4
10
  export const getQueryClientContext = () => {
5
11
  const client = getContext(_contextKey);
6
12
  if (!client) {
@@ -8,7 +14,26 @@ export const getQueryClientContext = () => {
8
14
  }
9
15
  return client;
10
16
  };
11
- /** Sets a QueryClient on Svelte's context */
17
+ /**
18
+ * Sets a `QueryClient` on Svelte's context, so it can be read with {@link getQueryClientContext} (or
19
+ * {@link useQueryClient}) from any descendant component. `QueryClientProvider` wraps this — use it directly
20
+ * only if you need to set the client from your own component instead.
21
+ *
22
+ * @param client - The `QueryClient` to make available to descendant components.
23
+ *
24
+ * @example
25
+ * ```svelte
26
+ * <script lang="ts">
27
+ * import { QueryClient, QueryClientProvider } from '@tanstack/svelte-query'
28
+ *
29
+ * const queryClient = new QueryClient()
30
+ * </script>
31
+ *
32
+ * <QueryClientProvider client={queryClient}>
33
+ * ...
34
+ * </QueryClientProvider>
35
+ * ```
36
+ */
12
37
  export const setQueryClientContext = (client) => {
13
38
  setContext(_contextKey, client);
14
39
  };
@@ -1,4 +1,100 @@
1
1
  import type { DefaultError, InfiniteData, QueryClient, QueryKey } from '@tanstack/query-core';
2
- import type { Accessor, CreateInfiniteQueryOptions, CreateInfiniteQueryResult } from './types.js';
2
+ import type { Accessor, CreateInfiniteQueryOptions, CreateInfiniteQueryResult, DefinedCreateInfiniteQueryResult } from './types.js';
3
+ import type { DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions } from './infiniteQueryOptions.js';
4
+ export declare function createInfiniteQuery<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: Accessor<DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>>, queryClient?: Accessor<QueryClient>): DefinedCreateInfiniteQueryResult<TData, TError>;
5
+ export declare function createInfiniteQuery<TQueryFnData = unknown, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: Accessor<UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>>, queryClient?: Accessor<QueryClient>): CreateInfiniteQueryResult<TData, TError>;
6
+ /**
7
+ * @see {@link infiniteQueryOptions} to share these options between `createInfiniteQuery` and imperative APIs
8
+ * like `queryClient.infiniteQuery`.
9
+ * @param options - The {@link CreateInfiniteQueryOptions} to use — everything you can pass to
10
+ * `createInfiniteQuery`, wrapped in an {@link Accessor} so options can be reactive.
11
+ * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
12
+ * be used.
13
+ * @returns The current query result, plus `fetchNextPage`/`fetchPreviousPage`/`hasNextPage`/`hasPreviousPage`
14
+ * to page through the query.
15
+ *
16
+ * @example
17
+ * Fetching the next page from a "Load More" button click:
18
+ * ```svelte
19
+ * <script lang="ts">
20
+ * import { createInfiniteQuery } from '@tanstack/svelte-query'
21
+ *
22
+ * const query = createInfiniteQuery(() => ({
23
+ * queryKey: ['projects'],
24
+ * queryFn: ({ pageParam }) => fetchProjects(pageParam),
25
+ * initialPageParam: 0,
26
+ * getNextPageParam: (lastPage) => lastPage.nextId,
27
+ * }))
28
+ * </script>
29
+ *
30
+ * {#if query.isPending}
31
+ * Loading...
32
+ * {:else if query.isError}
33
+ * <span>Error: {query.error.message}</span>
34
+ * {:else}
35
+ * <ul>
36
+ * {#each query.data.pages as page}
37
+ * {#each page.projects as project (project.id)}
38
+ * <li>{project.name}</li>
39
+ * {/each}
40
+ * {/each}
41
+ * </ul>
42
+ * <button
43
+ * onclick={() => query.fetchNextPage()}
44
+ * disabled={!query.hasNextPage || query.isFetching}
45
+ * >
46
+ * {query.isFetchingNextPage
47
+ * ? 'Loading more...'
48
+ * : query.hasNextPage
49
+ * ? 'Load More'
50
+ * : 'Nothing more to load'}
51
+ * </button>
52
+ * {/if}
53
+ * ```
54
+ *
55
+ * @example
56
+ * Fetching the next page automatically as the user scrolls, using an `IntersectionObserver` on a
57
+ * sentinel element after the list:
58
+ * ```svelte
59
+ * <script lang="ts">
60
+ * import { createInfiniteQuery } from '@tanstack/svelte-query'
61
+ *
62
+ * const query = createInfiniteQuery(() => ({
63
+ * queryKey: ['projects'],
64
+ * queryFn: ({ pageParam }) => fetchProjects(pageParam),
65
+ * initialPageParam: 0,
66
+ * getNextPageParam: (lastPage) => lastPage.nextId,
67
+ * }))
68
+ *
69
+ * let sentinel: HTMLDivElement | undefined = $state()
70
+ *
71
+ * $effect(() => {
72
+ * if (sentinel == null || !query.hasNextPage || query.isFetching) return
73
+ *
74
+ * const observer = new IntersectionObserver(([entry]) => {
75
+ * if (entry?.isIntersecting) query.fetchNextPage()
76
+ * })
77
+ * observer.observe(sentinel)
78
+ *
79
+ * return () => observer.disconnect()
80
+ * })
81
+ * </script>
82
+ *
83
+ * {#if query.isPending}
84
+ * Loading...
85
+ * {:else if query.isError}
86
+ * <span>Error: {query.error.message}</span>
87
+ * {:else}
88
+ * <ul>
89
+ * {#each query.data.pages as page}
90
+ * {#each page.projects as project (project.id)}
91
+ * <li>{project.name}</li>
92
+ * {/each}
93
+ * {/each}
94
+ * </ul>
95
+ * <div bind:this={sentinel}></div>
96
+ * {/if}
97
+ * ```
98
+ */
3
99
  export declare function createInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: Accessor<CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>>, queryClient?: Accessor<QueryClient>): CreateInfiniteQueryResult<TData, TError>;
4
100
  //# sourceMappingURL=createInfiniteQuery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createInfiniteQuery.d.ts","sourceRoot":"","sources":["../src/createInfiniteQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,Y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,MAAM,CAAC,CAAA;AAElD,wBAAgB,mBAAmB,CACjC,YAAY,GAAG,OAAO,EACtB,MAAM,GAAG,YAAY,EACrB,KAAK,GAAG,YAAY,CAAC,YAAY,CAAC,EAClC,SAAS,SAAS,QAAQ,GAAG,QAAQ,EACrC,UAAU,GAAG,OAAO,EAEpB,OAAO,EAAE,QAAQ,CACf,mCAAmC,CACjC,YAAY,EACZ,MAAM,EACN,KAAK,EACL,SAAS,EACT,UAAU,CACX,CACF,EACD,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAClC,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EACZ,MAAM,GAAG,YAAY,EACrB,KAAK,GAAG,YAAY,CAAC,YAAY,CAAC,EAClC,SAAS,SAAS,QAAQ,GAAG,QAAQ,EACrC,UAAU,GAAG,OAAO,EAEpB,OAAO,EAAE,QAAQ,CACf,0BAA0B,CACxB,YAAY,EACZ,MAAM,EACN,KAAK,EACL,SAAS,EACT,UAAU,CACX,CACF,EACD,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAClC,yBAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA"}
@@ -1,8 +1,162 @@
1
1
  import type { Accessor, CreateMutationOptions, CreateMutationResult } from './types.js';
2
2
  import type { DefaultError, QueryClient } from '@tanstack/query-core';
3
3
  /**
4
- * @param options - A function that returns mutation options
5
- * @param queryClient - Custom query client which overrides provider
4
+ * Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
5
+ * `createMutation` is the function for that.
6
+ *
7
+ * @see {@link mutationOptions} to share these options across multiple `createMutation` call sites, or to look
8
+ * the mutation up elsewhere via its `mutationKey` (e.g. with `useMutationState`).
9
+ * @param options - The {@link CreateMutationOptions} to use, wrapped in an {@link Accessor} so options can be
10
+ * reactive.
11
+ * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
12
+ * be used.
13
+ * @returns `mutate`/`mutateAsync` also accept per-call `onSuccess`/`onError`/`onSettled` callbacks as a second
14
+ * argument, useful for triggering call-site side effects (e.g. navigation) without coupling them to the shared
15
+ * mutation definition. If you make multiple requests, `onSuccess` will fire only after the latest call you've
16
+ * made.
17
+ *
18
+ * @example
19
+ * ```svelte
20
+ * <script lang="ts">
21
+ * import { createMutation, useQueryClient } from '@tanstack/svelte-query'
22
+ *
23
+ * const queryClient = useQueryClient()
24
+ *
25
+ * const addMutation = createMutation(() => ({
26
+ * mutationFn: addTodo,
27
+ * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
28
+ * }))
29
+ * </script>
30
+ *
31
+ * <button
32
+ * onclick={() =>
33
+ * addMutation.mutate('Item', {
34
+ * onError: (error) => console.error('Failed to add item:', error),
35
+ * })
36
+ * }
37
+ * >
38
+ * Add
39
+ * </button>
40
+ * ```
41
+ *
42
+ * @example
43
+ * Rendering the mutation's own state, rather than just firing it off:
44
+ * ```svelte
45
+ * <script lang="ts">
46
+ * import { createMutation, useQueryClient } from '@tanstack/svelte-query'
47
+ *
48
+ * const queryClient = useQueryClient()
49
+ *
50
+ * const addMutation = createMutation(() => ({
51
+ * mutationFn: addTodo,
52
+ * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
53
+ * }))
54
+ * </script>
55
+ *
56
+ * {#if addMutation.isPending}
57
+ * Adding todo...
58
+ * {:else}
59
+ * {#if addMutation.isError}
60
+ * <div>An error occurred: {addMutation.error.message}</div>
61
+ * {/if}
62
+ * <button onclick={() => addMutation.mutate('Item')}>Add</button>
63
+ * {/if}
64
+ * ```
65
+ *
66
+ * @example
67
+ * Optimistic update via `onMutate`, rolling back on `onError`:
68
+ * ```svelte
69
+ * <script lang="ts">
70
+ * import { createMutation, useQueryClient } from '@tanstack/svelte-query'
71
+ *
72
+ * const queryClient = useQueryClient()
73
+ *
74
+ * const addMutation = createMutation(() => ({
75
+ * mutationFn: addTodo,
76
+ * onMutate: async (newTodo: string) => {
77
+ * await queryClient.cancelQueries({ queryKey: ['todos'] })
78
+ * const previousTodos = queryClient.getQueryData<Array<string>>(['todos'])
79
+ *
80
+ * queryClient.setQueryData<Array<string>>(['todos'], (old) => [
81
+ * ...(old ?? []),
82
+ * newTodo,
83
+ * ])
84
+ *
85
+ * // Passed to `onError` as `onMutateResult` if the mutation fails.
86
+ * return { previousTodos }
87
+ * },
88
+ * onError: (_err, _newTodo, onMutateResult) => {
89
+ * queryClient.setQueryData(['todos'], onMutateResult?.previousTodos)
90
+ * },
91
+ * onSettled: () => {
92
+ * queryClient.invalidateQueries({ queryKey: ['todos'] })
93
+ * },
94
+ * }))
95
+ * </script>
96
+ *
97
+ * <button onclick={() => addMutation.mutate('Item')}>Add</button>
98
+ * ```
99
+ *
100
+ * @example
101
+ * Callbacks passed per call to `mutate` only fire for the last call — `mutateAsync` gives you a
102
+ * promise per call instead, so you can wait for all of them when they succeed:
103
+ * ```svelte
104
+ * <script lang="ts">
105
+ * import { createMutation, useQueryClient } from '@tanstack/svelte-query'
106
+ *
107
+ * const queryClient = useQueryClient()
108
+ *
109
+ * const addMutation = createMutation(() => ({
110
+ * mutationFn: addTodo,
111
+ * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
112
+ * }))
113
+ *
114
+ * async function handleAddAll(todos: Array<string>) {
115
+ * try {
116
+ * await Promise.all(todos.map((todo) => addMutation.mutateAsync(todo)))
117
+ * } catch (error) {
118
+ * console.error('Failed to add todos:', error)
119
+ * }
120
+ * }
121
+ * </script>
122
+ *
123
+ * <button onclick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>
124
+ * Add all
125
+ * </button>
126
+ * ```
127
+ *
128
+ * @example
129
+ * If some of the mutations above can fail independently of the others, and you want to know which ones
130
+ * did — rather than losing that information the moment the first one rejects — swap `Promise.all` for
131
+ * `Promise.allSettled`:
132
+ * ```svelte
133
+ * <script lang="ts">
134
+ * import { createMutation, useQueryClient } from '@tanstack/svelte-query'
135
+ *
136
+ * const queryClient = useQueryClient()
137
+ *
138
+ * const addMutation = createMutation(() => ({
139
+ * mutationFn: addTodo,
140
+ * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
141
+ * }))
142
+ *
143
+ * async function handleAddAll(todos: Array<string>) {
144
+ * const addResults = await Promise.allSettled(
145
+ * todos.map((todo) => addMutation.mutateAsync(todo)),
146
+ * )
147
+ *
148
+ * addResults.forEach((addResult, index) => {
149
+ * if (addResult.status === 'rejected') {
150
+ * console.error(`Failed to add "${todos[index]}":`, addResult.reason)
151
+ * }
152
+ * })
153
+ * }
154
+ * </script>
155
+ *
156
+ * <button onclick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>
157
+ * Add all
158
+ * </button>
159
+ * ```
6
160
  */
7
161
  export declare function createMutation<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(options: Accessor<CreateMutationOptions<TData, TError, TVariables, TContext>>, queryClient?: Accessor<QueryClient>): CreateMutationResult<TData, TError, TVariables, TContext>;
8
162
  //# sourceMappingURL=createMutation.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createMutation.svelte.d.ts","sourceRoot":"","sources":["../src/createMutation.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,QAAQ,EAER,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAErE;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,OAAO,EAElB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,EAC7E,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAClC,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAiE3D"}
1
+ {"version":3,"file":"createMutation.svelte.d.ts","sourceRoot":"","sources":["../src/createMutation.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,QAAQ,EAER,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6JG;AACH,wBAAgB,cAAc,CAC5B,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,OAAO,EAElB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,EAC7E,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAClC,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAiE3D"}
@@ -2,8 +2,162 @@ import { MutationObserver, noop, notifyManager } from '@tanstack/query-core';
2
2
  import { useQueryClient } from './useQueryClient.js';
3
3
  import { watchChanges } from './utils.svelte.js';
4
4
  /**
5
- * @param options - A function that returns mutation options
6
- * @param queryClient - Custom query client which overrides provider
5
+ * Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
6
+ * `createMutation` is the function for that.
7
+ *
8
+ * @see {@link mutationOptions} to share these options across multiple `createMutation` call sites, or to look
9
+ * the mutation up elsewhere via its `mutationKey` (e.g. with `useMutationState`).
10
+ * @param options - The {@link CreateMutationOptions} to use, wrapped in an {@link Accessor} so options can be
11
+ * reactive.
12
+ * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
13
+ * be used.
14
+ * @returns `mutate`/`mutateAsync` also accept per-call `onSuccess`/`onError`/`onSettled` callbacks as a second
15
+ * argument, useful for triggering call-site side effects (e.g. navigation) without coupling them to the shared
16
+ * mutation definition. If you make multiple requests, `onSuccess` will fire only after the latest call you've
17
+ * made.
18
+ *
19
+ * @example
20
+ * ```svelte
21
+ * <script lang="ts">
22
+ * import { createMutation, useQueryClient } from '@tanstack/svelte-query'
23
+ *
24
+ * const queryClient = useQueryClient()
25
+ *
26
+ * const addMutation = createMutation(() => ({
27
+ * mutationFn: addTodo,
28
+ * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
29
+ * }))
30
+ * </script>
31
+ *
32
+ * <button
33
+ * onclick={() =>
34
+ * addMutation.mutate('Item', {
35
+ * onError: (error) => console.error('Failed to add item:', error),
36
+ * })
37
+ * }
38
+ * >
39
+ * Add
40
+ * </button>
41
+ * ```
42
+ *
43
+ * @example
44
+ * Rendering the mutation's own state, rather than just firing it off:
45
+ * ```svelte
46
+ * <script lang="ts">
47
+ * import { createMutation, useQueryClient } from '@tanstack/svelte-query'
48
+ *
49
+ * const queryClient = useQueryClient()
50
+ *
51
+ * const addMutation = createMutation(() => ({
52
+ * mutationFn: addTodo,
53
+ * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
54
+ * }))
55
+ * </script>
56
+ *
57
+ * {#if addMutation.isPending}
58
+ * Adding todo...
59
+ * {:else}
60
+ * {#if addMutation.isError}
61
+ * <div>An error occurred: {addMutation.error.message}</div>
62
+ * {/if}
63
+ * <button onclick={() => addMutation.mutate('Item')}>Add</button>
64
+ * {/if}
65
+ * ```
66
+ *
67
+ * @example
68
+ * Optimistic update via `onMutate`, rolling back on `onError`:
69
+ * ```svelte
70
+ * <script lang="ts">
71
+ * import { createMutation, useQueryClient } from '@tanstack/svelte-query'
72
+ *
73
+ * const queryClient = useQueryClient()
74
+ *
75
+ * const addMutation = createMutation(() => ({
76
+ * mutationFn: addTodo,
77
+ * onMutate: async (newTodo: string) => {
78
+ * await queryClient.cancelQueries({ queryKey: ['todos'] })
79
+ * const previousTodos = queryClient.getQueryData<Array<string>>(['todos'])
80
+ *
81
+ * queryClient.setQueryData<Array<string>>(['todos'], (old) => [
82
+ * ...(old ?? []),
83
+ * newTodo,
84
+ * ])
85
+ *
86
+ * // Passed to `onError` as `onMutateResult` if the mutation fails.
87
+ * return { previousTodos }
88
+ * },
89
+ * onError: (_err, _newTodo, onMutateResult) => {
90
+ * queryClient.setQueryData(['todos'], onMutateResult?.previousTodos)
91
+ * },
92
+ * onSettled: () => {
93
+ * queryClient.invalidateQueries({ queryKey: ['todos'] })
94
+ * },
95
+ * }))
96
+ * </script>
97
+ *
98
+ * <button onclick={() => addMutation.mutate('Item')}>Add</button>
99
+ * ```
100
+ *
101
+ * @example
102
+ * Callbacks passed per call to `mutate` only fire for the last call — `mutateAsync` gives you a
103
+ * promise per call instead, so you can wait for all of them when they succeed:
104
+ * ```svelte
105
+ * <script lang="ts">
106
+ * import { createMutation, useQueryClient } from '@tanstack/svelte-query'
107
+ *
108
+ * const queryClient = useQueryClient()
109
+ *
110
+ * const addMutation = createMutation(() => ({
111
+ * mutationFn: addTodo,
112
+ * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
113
+ * }))
114
+ *
115
+ * async function handleAddAll(todos: Array<string>) {
116
+ * try {
117
+ * await Promise.all(todos.map((todo) => addMutation.mutateAsync(todo)))
118
+ * } catch (error) {
119
+ * console.error('Failed to add todos:', error)
120
+ * }
121
+ * }
122
+ * </script>
123
+ *
124
+ * <button onclick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>
125
+ * Add all
126
+ * </button>
127
+ * ```
128
+ *
129
+ * @example
130
+ * If some of the mutations above can fail independently of the others, and you want to know which ones
131
+ * did — rather than losing that information the moment the first one rejects — swap `Promise.all` for
132
+ * `Promise.allSettled`:
133
+ * ```svelte
134
+ * <script lang="ts">
135
+ * import { createMutation, useQueryClient } from '@tanstack/svelte-query'
136
+ *
137
+ * const queryClient = useQueryClient()
138
+ *
139
+ * const addMutation = createMutation(() => ({
140
+ * mutationFn: addTodo,
141
+ * onSuccess: () => queryClient.invalidateQueries({ queryKey: ['todos'] }),
142
+ * }))
143
+ *
144
+ * async function handleAddAll(todos: Array<string>) {
145
+ * const addResults = await Promise.allSettled(
146
+ * todos.map((todo) => addMutation.mutateAsync(todo)),
147
+ * )
148
+ *
149
+ * addResults.forEach((addResult, index) => {
150
+ * if (addResult.status === 'rejected') {
151
+ * console.error(`Failed to add "${todos[index]}":`, addResult.reason)
152
+ * }
153
+ * })
154
+ * }
155
+ * </script>
156
+ *
157
+ * <button onclick={() => handleAddAll(['Todo 1', 'Todo 2', 'Todo 3'])}>
158
+ * Add all
159
+ * </button>
160
+ * ```
7
161
  */
8
162
  export function createMutation(options, queryClient) {
9
163
  const client = $derived(useQueryClient(queryClient?.()));
@@ -64,6 +64,77 @@ export type QueriesResults<T extends Array<any>, TResults extends Array<any> = [
64
64
  ]> : {
65
65
  [K in keyof T]: GetCreateQueryResult<T[K]>;
66
66
  };
67
+ /**
68
+ * @param createQueriesOptions - The `queries` array to run, and an optional `combine` function, wrapped in an
69
+ * {@link Accessor} so options can be reactive.
70
+ * @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context
71
+ * will be used.
72
+ * @returns An array with one result per query, in the same order as `queries` — or, if `combine` is provided,
73
+ * whatever `combine` returns.
74
+ *
75
+ * @example
76
+ * ```svelte
77
+ * <script lang="ts">
78
+ * import { createQueries } from '@tanstack/svelte-query'
79
+ *
80
+ * let { ids }: { ids: Array<number> } = $props()
81
+ *
82
+ * const postQueries = createQueries(() => ({
83
+ * queries: ids.map((id) => ({
84
+ * queryKey: ['post', id],
85
+ * queryFn: () => fetchPost(id),
86
+ * staleTime: Infinity,
87
+ * })),
88
+ * }))
89
+ * </script>
90
+ *
91
+ * <ul>
92
+ * {#each postQueries as query, index (ids[index])}
93
+ * {#if query.isPending}
94
+ * <li>Loading...</li>
95
+ * {:else if query.isError}
96
+ * <li>Error: {query.error.message}</li>
97
+ * {:else}
98
+ * <li>{query.data.title}</li>
99
+ * {/if}
100
+ * {/each}
101
+ * </ul>
102
+ * ```
103
+ *
104
+ * @example
105
+ * Combining results into a single value:
106
+ * ```svelte
107
+ * <script lang="ts">
108
+ * import { createQueries } from '@tanstack/svelte-query'
109
+ *
110
+ * let { ids }: { ids: Array<number> } = $props()
111
+ *
112
+ * const combined = createQueries(() => ({
113
+ * queries: ids.map((id) => ({
114
+ * queryKey: ['post', id],
115
+ * queryFn: () => fetchPost(id),
116
+ * })),
117
+ * combine: (postQueries) => ({
118
+ * data: postQueries.map((query) => query.data),
119
+ * isPending: postQueries.some((query) => query.isPending),
120
+ * isError: postQueries.some((query) => query.isError),
121
+ * }),
122
+ * }))
123
+ * </script>
124
+ *
125
+ * {#if combined.isPending}
126
+ * Loading...
127
+ * {:else if combined.isError}
128
+ * Error loading posts
129
+ * {:else}
130
+ * <ul>
131
+ * {#each combined.data as post}
132
+ * <li>{post?.title}</li>
133
+ * {/each}
134
+ * </ul>
135
+ * {/if}
136
+ * ```
137
+ */
67
138
  export declare function createQueries<T extends Array<any>, TCombinedResult = QueriesResults<T>>(createQueriesOptions: Accessor<{
68
139
  queries: readonly [...QueriesOptions<T>] | readonly [
69
140
  ...{
@@ -1 +1 @@
1
- {"version":3,"file":"createQueries.svelte.d.ts","sourceRoot":"","sources":["../src/createQueries.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,YAAY,CAAA;AACnB,OAAO,KA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