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

Back and Forward of the Router from next/navigation Doesn't Trigger the Guard / app router #21

Open
abdullah-bahraq opened this issue Jan 23, 2025 · 3 comments

Comments

@abdullah-bahraq
Copy link

When using the useRouter from the next/navigation, navigation through the browser's back and forward buttons does not trigger the navigation guard

however it's working fine with Lniks and router.refersh

Thanks in advance!

**Environment:**
Next.js Version: 14.1.1
Node.js Version: 22.11.0
Browser: google chrome_
@wootera
Copy link

wootera commented Jan 23, 2025

I confirm the same issue:

Chrome: 131.0.6778.267 
next-navigation-guard: 0.1.2

@raine
Copy link

raine commented Jan 23, 2025

I'm experiencing a similar issue, where browser's back and forward buttons mostly don't trigger the guard prompt. But in one instance it did, and not sure what was different.

@wootera
Copy link

wootera commented Jan 23, 2025

Yes, I can confirm from my testing today that it does work in some cases (the URL changes, but the alert message triggers and if I click Cancel then routing is reverted and my state is intact) - but it doesn't work in some others... I wasn't able to find a pattern though :(

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

3 participants