PageSourceSearch

https://iconited.com/assets/useMutation-DZfcQAwJ.js

js iconited.com collected 2026-10-10 02:34:01 UTC 2,076 bytes, 2 lines download raw bytes

1import{r as o}from"./chunk-OIYGIGL5-gwPc8tBz.js";import{S as l,s as p,h,g as b,n as a,u as d,b as m,c as f}from"./trpc-tanstack-CcrFfedX.js";var v=class extends l{#e;#i=void 0;#t;#s;constructor(t,s){super(),this.#e=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#e.defaultMutationOptions(t),p(this.options,s)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&h(s.mutationKey)!==h(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#s=s,this.#t?.removeObserver(this),this.#t=this.#e.getMutationCache().build(this.#e,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??b();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){a.batch(()=>{if(this.#s&&this.hasListeners()){const s=this.#i.variables,i=this.#i.context;t?.type==="success"?(this.#s.onSuccess?.(t.data,s,i),this.#s.onSettled?.(t.data,null,s,i)):t?.type==="error"&&(this.#s.onError?.(t.error,s,i),this.#s.onSettled?.(void 0,t.error,s,i))}this.listeners.forEach(s=>{s(this.#i)})})}};function g(t,s){const i=d(s),[e]=o.useState(()=>new v(i,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const r=o.useSyncExternalStore(o.useCallback(n=>e.subscribe(a.batchCalls(n)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((n,c)=>{e.mutate(n,c).catch(m)},[e]);if(r.error&&f(e.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:u,mutateAsync:r.mutate}}export{g as u};
2//# sourceMappingURL=useMutation-DZfcQAwJ.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.