Skip to content

URL path is incorrect and leads to 404 in app router navigation guard implementation #41

@ashoofly

Description

@ashoofly

This bug was noticed after v0.2.0 was released.
We noticed a doubling of the basePath in the return URL, and could reproduce it in your example demo.
It did not reproduce when running your example locally though.

To Reproduce

  1. Go to https://layerxcom.github.io/next-navigation-guard/page1 and Enable Navigation Guard.
  2. Click on 'Page 2' under App Router.
  3. After clicking OK and Leave on the dialogs, you are routed to: https://layerxcom.github.io/next-navigation-guard/next-navigation-guard/page2

Notes

  • In our app, we have a basePath set in our next.config.js.
  • When running in debug mode, I see:
[next-navigation-guard] No original router found

Expected Behavior
Route to https://layerxcom.github.io/next-navigation-guard/page2 instead

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions