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

Unexpected behavior when hash routing is enabled #307

Open
mlaadd opened this issue Nov 9, 2021 · 0 comments
Open

Unexpected behavior when hash routing is enabled #307

mlaadd opened this issue Nov 9, 2021 · 0 comments

Comments

@mlaadd
Copy link

mlaadd commented Nov 9, 2021

When hash routing is enabled, on first page visit (or reload), it will return a different hashString as compared to when i normally navigate on the page through an href with data-navigo.

let router = new Navigo("/", { hash: true});
router.on({
"/": (params)=>{console.log(params);},
"/test": (params)=>{console.log(params);}
});
router.resolve();

for example:
on first load:
> example.com/#/test
< params.hashString is "/test"
on navigation through a link (data-navigo href="/test"):
> example.com/#/test
< params.hashString is ""

normally i would expect it to return "" on both occasions.

however if an "actual" hash is provided it works like that
on first load:
> example.com/#/test#test2
< params.hashString is "test2"
on navigation through a link (data-navigo href="/test#test2")::
> example.com/#/test#test2
< Navigo: "test2" didn't match any of the registered routes.

here i would expect them to return "test2"

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