MCPcopy Create free account
hub / github.com/SvelteStack/svelte-query / parseMutationArgs

Function parseMutationArgs

src/queryCore/core/utils.ts:135–154  ·  view source on GitHub ↗
(
  arg1: MutationKey | MutationFunction<any, any> | TOptions,
  arg2?: MutationFunction<any, any> | TOptions,
  arg3?: TOptions
)

Source from the content-addressed store, hash-verified

133}
134
135export function parseMutationArgs<
136 TOptions extends MutationOptions<any, any, any, any>
137>(
138 arg1: MutationKey | MutationFunction<any, any> | TOptions,
139 arg2?: MutationFunction<any, any> | TOptions,
140 arg3?: TOptions
141): TOptions {
142 if (isQueryKey(arg1)) {
143 if (typeof arg2 === 'function') {
144 return { ...arg3, mutationKey: arg1, mutationFn: arg2 } as TOptions
145 }
146 return { ...arg2, mutationKey: arg1 } as TOptions
147 }
148
149 if (typeof arg1 === 'function') {
150 return { ...arg2, mutationFn: arg1 } as TOptions
151 }
152
153 return { ...arg1 } as TOptions
154}
155
156export function parseFilterArgs<
157 TFilters extends QueryFilters,

Callers 2

useMutationFunction · 0.90
setOptionsFunction · 0.90

Calls 1

isQueryKeyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…