import{r as t}from"./sikshya-admin-sikshya-react-E_TY_un4.js";function p(r,l){const a=t.useRef(r);a.current=r;const[o,n]=t.useState(!0),[f,c]=t.useState(null),[i,u]=t.useState(null),[d,y]=t.useState(0),S=t.useCallback(()=>{y(e=>e+1)},[]);return t.useEffect(()=>{let e=!1;return n(!0),u(null),(async()=>{try{const s=await a.current();e||c(s)}catch(s){e||(u(s),c(null))}finally{e||n(!1)}})(),()=>{e=!0}},[d,...l]),{loading:o,data:f,error:i,refetch:S}}export{p as u};
