diff --git a/frontend/src/lib/useUnsavedChangesGuard.tsx b/frontend/src/lib/useUnsavedChangesGuard.tsx index 089eb5d..b866ad4 100644 --- a/frontend/src/lib/useUnsavedChangesGuard.tsx +++ b/frontend/src/lib/useUnsavedChangesGuard.tsx @@ -7,7 +7,7 @@ import { useRef, useState, } from 'react' -import { useBlocker, useLocation } from 'react-router-dom' +import { useLocation } from 'react-router-dom' import { useDialogue } from '@/lib/dialogues/useDialogue' @@ -65,31 +65,6 @@ export const UnsavedChangesGuardProvider: FC = ({ children }) return true }, [dialogue, source]) - const blocker = useBlocker (() => - source?.dirty === true && !(bypassNextNavigationRef.current)) - - useEffect (() => { - if (blocker.state !== 'blocked') - return - - let cancelled = false - - void (async () => { - const confirmed = await confirmDiscardNavigation () - if (cancelled) - return - - if (confirmed) - blocker.proceed () - else - blocker.reset () - }) () - - return () => { - cancelled = true - } - }, [blocker, confirmDiscardNavigation]) - useEffect (() => { bypassNextNavigationRef.current = false }, [location.hash, location.pathname, location.search])