-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
clicking hash link recorded in history twice #3636
Comments
I think replacing |
Maybe related to #3621? |
Yeah it does look like that this issue causes #3621. cc @vicky1999 in case you're already working on a fix. |
@bluwy I think the above fix will solve the issue. but, we need to check this once. |
* fix: skip navigation if only url hash change * docs: update pushState comment * remove _tests.js Co-authored-by: Rich Harris <hello@rich-harris.dev>
I think some code change the history ,so I global searched // Check if new url only differs by hash
if (url.href.split('#')[0] === location.href.split('#')[0]) {
// Call `pushState` to add url to history so going back works.
// Also make a delay, otherwise the browser default behaviour would not kick in
setTimeout(() => history.pushState({}, '', url.href));
const info = this.parse(url);
if (info) {
return this.renderer.update(info, [], false);
}
return;
} I don't know what does these code do, |
I've sent a PR for a failing test that can be uncommented when this issue is fixed: #3880 |
This was fixed recently. The test has now been uncommented and passes:
|
Great thanks to @benmccann ! |
Describe the bug
When opening
#anchor-a
then click a link to#anchor-b
, history newly records entries#anchor-a
and#anchor-b
though#anchor-a
is previous location.Therefore, hisotry looks like:
Disabling
router
byexport const router = false;
mitigate this issue, so that I think router has some issue around this.Reproduction
https://stackblitz.com/edit/sveltekit-ivmzya?devtoolsheight=33&file=src/routes/index.svelte
Easily understand by following steps:
Open in New Window
in Stackblitz(Also I notified
null
is oddly appealing on first clicking#anchor-b
)Logs
No response
System Info
The text was updated successfully, but these errors were encountered: