Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also prevent navigation through router.push #23

Open
CombeeMike opened this issue Jan 24, 2025 · 0 comments
Open

Also prevent navigation through router.push #23

CombeeMike opened this issue Jan 24, 2025 · 0 comments

Comments

@CombeeMike
Copy link

Should an enabled navigation guard also prevent navigation through router.push (where router = useRouter() from next/navigation)?

If it should, I'm seeing a bug. The enabled navigation guard shows the confirm dialog when clicking browser back, but does not show, when navigating using router.push(...).

I enabled the guard using useNavigationGuard({ enabled: formHasChanges, confirm: () => window.confirm('You have unsaved changes that will be lost.') });.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant