fix: decode URL before navigating when hash router is enabled - #13321
Conversation
🦋 Changeset detectedLatest commit: 72586fb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
preview: https://svelte-dev-git-preview-kit-13321-svelte.vercel.app/ this is an automated message |
|
@eltigerchino How would this work with a URL like |
Good point. It probably wouldn't work since it decodes the entire URL instead of just the hash segment. I'll work on a fix. EDIT: here's the PR with the fix #13332 |
fixes #13318
This PR decodes the URL when the hash router is enabled and the user enters the URL through the browser address bar (during app initialisation and the
hashchangeevent). We need to do this because Safari seems to encode any extra hashes in the URL (only when accessed through the file protocol?). So, entering/#/#aboutin the address bar becomes/#/%23aboutwhich the client router incorrectly thinks is a route instead of just an ID.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits