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

Navigating between /route and /route#hash breaks intermittently. #10524

Closed
whataboutpereira opened this issue Aug 10, 2023 · 6 comments
Closed
Labels
bug Something isn't working router

Comments

@whataboutpereira
Copy link
Contributor

Describe the bug

When navigating between a route and the same route with hash link, sometimes navigation breaks.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-ysligc

When alternating TEST (/test) and ONE (/test#one) links, navigating to ONE (#one) stops working eventually.

It seems to me as if some of the time SvelteKit thinks it's still on /test#one after navigating to /test.

You can unstuck navigation by navigating either once more to /test or navigating to another hash (any except #one).

Logs

No errors in browser logs.

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.20.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.6.10 - /usr/local/bin/pnpm
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.0 
    @sveltejs/kit: ^1.20.4 => 1.22.4 
    svelte: ^4.0.5 => 4.1.2 
    vite: ^4.4.2 => 4.4.9

Severity

annoyance

Additional Information

Sometimes navigating from /test#hash back to /test triggers a full page reload, but I couldn't replicate it on Stackblitz.

@ollyde
Copy link

ollyde commented Aug 22, 2023

I also face the same issue, Sveltekit is broken it seems :-/

I noticed it only happens on the root url, or root page.

@whataboutpereira
Copy link
Contributor Author

I notice $page.url.hash and window.location.hash are also going out of sync.
Tested with Chrome in Windows.

@eltigerchino
Copy link
Member

eltigerchino commented Oct 8, 2023

closed as duplicate of #10550
EDIT: I'm an idiot. This issue goes beyond the :target css styles not working.

@eltigerchino
Copy link
Member

closed as duplicate of #10234

@eltigerchino eltigerchino closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2023
@whataboutpereira
Copy link
Contributor Author

I see it's still broken in v1.25.2.

https://stackblitz.com/edit/sveltejs-kit-template-default-utndzs?file=package.json

When alternating TEST (/test) and ONE (/test#one) links, navigating to ONE (#one) stops working eventually.

I see when it breaks and you click twice on /test, then clicking on /test#one works again (once).

@scosman
Copy link

scosman commented Jul 28, 2024

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working router
Projects
None yet
Development

No branches or pull requests

4 participants