{"version":3,"file":"useMounted-198bde0b.js","sources":["../../../../../../app/node_modules/@restart/hooks/esm/useMounted.js"],"sourcesContent":["import { useRef, useEffect } from 'react';\n\n/**\n * Track whether a component is current mounted. Generally less preferable than\n * properlly canceling effects so they don't run after a component is unmounted,\n * but helpful in cases where that isn't feasible, such as a `Promise` resolution.\n *\n * @returns a function that returns the current isMounted state of the component\n *\n * ```ts\n * const [data, setData] = useState(null)\n * const isMounted = useMounted()\n *\n * useEffect(() => {\n * fetchdata().then((newData) => {\n * if (isMounted()) {\n * setData(newData);\n * }\n * })\n * })\n * ```\n */\nexport default function useMounted() {\n const mounted = useRef(true);\n const isMounted = useRef(() => mounted.current);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n return isMounted.current;\n}"],"names":["useMounted","mounted","useRef","isMounted","useEffect"],"mappings":"mCAsBe,SAASA,GAAa,CACnC,MAAMC,EAAUC,SAAO,EAAI,EACrBC,EAAYD,EAAM,OAAC,IAAMD,EAAQ,OAAO,EAC9CG,OAAAA,EAAAA,UAAU,KACRH,EAAQ,QAAU,GACX,IAAM,CACXA,EAAQ,QAAU,EACxB,GACK,CAAE,CAAA,EACEE,EAAU,OACnB","x_google_ignoreList":[0]}