* 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,
)
| 1145 | * @returns The defaulted options. |
| 1146 | */ |
| 1147 | defaultMutationOptions<T extends MutationOptions<any, any, any, any>>( |
| 1148 | options?: T, |
| 1149 | ): T { |
| 1150 | if (options?._defaulted) { |
| 1151 | return options |
| 1152 | } |
| 1153 | return { |
| 1154 | ...this.#defaultOptions.mutations, |
| 1155 | ...(options?.mutationKey && |
| 1156 | this.getMutationDefaults(options.mutationKey)), |
| 1157 | ...options, |
| 1158 | _defaulted: true, |
| 1159 | } as T |
| 1160 | } |
| 1161 | |
| 1162 | /** |
| 1163 | * Clears both the query cache and the mutation cache this client is connected to. |
no test coverage detected