Skip to content

Commit 9a1d61c

Browse files
Merge pull request #1338 from syucream/fix/error-handler
Remove dependency on react router from error handler
2 parents 00c6594 + f578e52 commit 9a1d61c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

frontend/src/ErrorHandler.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
import { styled } from "@mui/material/styles";
1010
import React, { FC, useCallback, useEffect, useState } from "react";
1111
import { ErrorBoundary, FallbackProps } from "react-error-boundary";
12-
import { useNavigate } from "react-router-dom";
1312
import { useError } from "react-use";
1413

1514
import { ForbiddenErrorPage } from "./pages/ForbiddenErrorPage";
@@ -46,16 +45,15 @@ interface GenericErrorProps {
4645
}
4746

4847
const GenericError: FC<GenericErrorProps> = ({ children }) => {
49-
const navigate = useNavigate();
5048
const [open, setOpen] = useState(true);
5149

5250
const handleGoToTop = useCallback(() => {
53-
navigate(topPath(), { replace: true });
54-
}, [navigate]);
51+
window.location.href = topPath();
52+
}, []);
5553

5654
const handleReload = useCallback(() => {
57-
navigate(0);
58-
}, [navigate]);
55+
window.location.reload();
56+
}, []);
5957

6058
return (
6159
<Dialog open={open} onClose={() => setOpen(false)}>

0 commit comments

Comments
 (0)