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

Relative link when current location has #hash triggers a reload while it doesn't with no #hash or empty # #579

Open
dmnsgn opened this issue Dec 6, 2020 · 3 comments

Comments

@dmnsgn
Copy link

dmnsgn commented Dec 6, 2020

Setup

Two routes will render different pages:

page('/fruits', () => {})
page('/veggies', () => {})
page('/fruits/:name', () => {})
page('/veggies/:name', () => {})
page()

Problem

If on page /fruits/banana#calories you click on a link href "/veggies/tomato" (no other attribute), the page will reload. No problem with either /fruits/banana# or /fruits/banana. Sounds like an issue with handling hash?

@dmnsgn
Copy link
Author

dmnsgn commented Dec 6, 2020

Could it be that the /fruits#calories hashtag part is unhandled by my defined route above?

I am hitting the following infinite loop when clicking on an anchor that changes the hastag.

Uncaught RangeError: Maximum call stack size exceeded.
    at Page.unhandled (page.js:1056)
    at nextEnter (page.js:712)
    at eval (page.js:1183)
    at nextEnter (page.js:713)
    at eval (page.js:1183)
    at nextEnter (page.js:713)
    at eval (page.js:1183)
    at nextEnter (page.js:713)
    at eval (page.js:1183)
    at nextEnter (page.js:713)

And also the following line is only taking into account window.location.search and not window.location.hash?

current = isLocation && window.location.pathname + window.location.search;

@rkyoku
Copy link

rkyoku commented Jan 30, 2022

If you are calling page.stop() and page.start(), it may be because there is a bug in page.start() that doesn't set this._running = true; if you specified {dispatch: false}

Please see lines 551 and 552 of page.js.

Line 552 should have been put before line 551, or at the very least there should have been a way to set it to true.

I had to modify page.js for my website to work properly, but fortunately it was easy to modify.

@AshfordN
Copy link

I'm not sure I exactly understand your problem, but perhaps you can look at this answer and see if it applies.

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