* The mutation counterpart of QueryClient#defaultQueryOptions. Called by framework * adapters (e.g. inside `useMutation`) to merge the client's `defaultOptions.mutations`, then * `queryClient.setMutationDefaults` for the given `mutationKey`, then the caller's options on * top. A no-
(
options?: T,
)
| 1146 | * @returns The defaulted options. |
| 1147 | */ |
| 1148 | defaultMutationOptions<T extends MutationOptions<any, any, any, any>>( |
| 1149 | options?: T, |
| 1150 | ): T { |
| 1151 | if (options?._defaulted) { |
| 1152 | return options |
| 1153 | } |
| 1154 | return { |
| 1155 | ...this.#defaultOptions.mutations, |
| 1156 | ...(options?.mutationKey && |
| 1157 | this.getMutationDefaults(options.mutationKey)), |
| 1158 | ...options, |
| 1159 | _defaulted: true, |
| 1160 | } as T |
| 1161 | } |
| 1162 | |
| 1163 | /** |
| 1164 | * Clears both the query cache and the mutation cache this client is connected to. |
no test coverage detected