Watts-Lab / deliberation-empirica

Empirica V2 framework
MIT License
5 stars 0 forks source link

AxiosError: Network Error #795

Open sentry-io[bot] opened 1 month ago

sentry-io[bot] commented 1 month ago

Sentry Issue: DELIBERATION-EMPIRICA-65

AxiosError: Network Error
  at loadData (../../src/components/utils.js:71:24)
JamesPHoughton commented 1 week ago

need to catch failed fetches and retry before throwing:

export function useText({ file }) {
  const [text, setText] = useState(undefined);
  const url = useFileURL({ file });

  useEffect(() => {
    async function loadData() {
      const { data } = await axios.get(url); // catch errors
      setText(data);
    }
    if (url) loadData();
  }, [url]);
  return text;
}
JamesPHoughton commented 1 week ago

Also catch axios fetch errors in useConnectionInfo