MCPcopy Create free account
hub / github.com/ChurchApps/B1Admin / customErrorHandler

Function customErrorHandler

src/ControlPanel.tsx:35–43  ·  view source on GitHub ↗
(_error: ErrorLogInterface)

Source from the content-addressed store, hash-verified

33
34 const navigateRef = React.useRef(navigate);
35 navigateRef.current = navigate;
36 const pathRef = React.useRef(location.pathname);
37 pathRef.current = location.pathname;
38 // Dedupe identical errors within a short window so a failing page effect that
39 // refires can't spin the handler into an infinite loop.
40 const lastErrorRef = React.useRef<{ key: string; time: number }>({ key: "", time: 0 });
41 const redirectingRef = React.useRef(false);
42
43 // Re-arm the 401 redirect guard once the user lands back on the login screen.
44 React.useEffect(() => {
45 if (location.pathname.startsWith("/login")) redirectingRef.current = false;
46 }, [location.pathname]);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected