Skip to content

Fix duplicated push history#480

Merged
ryansolid merged 2 commits intosolidjs:mainfrom
Legend-Master:duplicated-push-history
Sep 23, 2024
Merged

Fix duplicated push history#480
ryansolid merged 2 commits intosolidjs:mainfrom
Legend-Master:duplicated-push-history

Conversation

@Legend-Master
Copy link
Copy Markdown
Contributor

@Legend-Master Legend-Master commented Sep 21, 2024

Fix #479

From debugging, it seems that we are changing the state to undefined here, while the state set from click events from anchor tags are from getAttribute which uses null, so the states are always different

const state = window.history.state && window.history.state._depth && Object.keys(window.history.state).length === 1 ? undefined : window.history.state;
return {
value: url + window.location.hash,
state
}

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Sep 21, 2024

🦋 Changeset detected

Latest commit: 0a964b6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ryansolid ryansolid merged commit 626c224 into solidjs:main Sep 23, 2024
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

Successfully merging this pull request may close these issues.

Duplicated history push when navigating back and forward and then clicking on a link

2 participants