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

Method executeMutation

src/queryCore/core/mutation.ts:231–253  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

229 }
230
231 private executeMutation(): Promise<TData> {
232 this.retryer = new Retryer({
233 fn: () => {
234 if (!this.options.mutationFn) {
235 return Promise.reject('No mutationFn found')
236 }
237 return this.options.mutationFn(this.state.variables!)
238 },
239 onFail: () => {
240 this.dispatch({ type: 'failed' })
241 },
242 onPause: () => {
243 this.dispatch({ type: 'pause' })
244 },
245 onContinue: () => {
246 this.dispatch({ type: 'continue' })
247 },
248 retry: this.options.retry ?? 0,
249 retryDelay: this.options.retryDelay,
250 })
251
252 return this.retryer.promise
253 }
254
255 private dispatch(action: Action<TData, TError, TVariables, TContext>): void {
256 this.state = reducer(this.state, action)

Callers 1

executeMethod · 0.95

Calls 2

dispatchMethod · 0.95
rejectMethod · 0.80

Tested by

no test coverage detected