PageSourceSearch

https://prompton.io/assets/useMutation-Cf8XIsOD.js

js prompton.io collected 2026-10-04 01:14:58 UTC 1,743 bytes, 1 lines download raw bytes

1import{a as e,n as t}from"./jsx-runtime-KJkY8l8U.js";import{t as n}from"./useApolloClient-BF9BMS-L.js";import{t as r}from"./lib--Q3Wpmjo.js";import{r as i,t as a}from"./mergeOptions-CjKtDOAr.js";function o(e){return e.catch(()=>{}),e}var s=e(t(),1),c=i?s.useLayoutEffect:s.useEffect,l=function(e,t){let i=n(t?.client),[l,d]=s.useState(()=>u(i)),f=s.useRef({result:l,mutationId:0,isMounted:!0,client:i,mutation:e,options:t});c(()=>{Object.assign(f.current,{client:i,options:t,mutation:e})});let p=s.useCallback((e={})=>{let{options:t,mutation:n}=f.current,i={...t,mutation:n},s=e.client||f.current.client,c=typeof e.context==`function`?e.context(t?.context):e.context;!f.current.result.loading&&f.current.isMounted&&d(f.current.result={loading:!0,error:void 0,data:void 0,called:!0,client:s});let l=++f.current.mutationId,u=a(i,{...e,context:c});return o(s.mutate(u).then(t=>{let{data:n,error:i}=t,a=e.onError||f.current.options?.onError;if(i&&a&&a(i,u),l===f.current.mutationId){let e={called:!0,loading:!1,data:n,error:i,client:s};f.current.isMounted&&!r(f.current.result,e)&&d(f.current.result=e)}let o=e.onCompleted||f.current.options?.onCompleted;return i||o?.(t.data,u),t},t=>{if(l===f.current.mutationId&&f.current.isMounted){let e={loading:!1,error:t,data:void 0,called:!0,client:s};r(f.current.result,e)||d(f.current.result=e)}let n=e.onError||f.current.options?.onError;throw n&&n(t,u),t}))},[]),m=s.useCallback(()=>{if(f.current.isMounted){let e=u(f.current.client);Object.assign(f.current,{mutationId:0,result:e}),d(e)}},[]);return s.useEffect(()=>{let e=f.current;return e.isMounted=!0,()=>{e.isMounted=!1}},[]),[p,{reset:m,...l}]};function u(e){return{data:void 0,error:void 0,called:!1,loading:!1,client:e}}export{o as n,l as t};

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.