-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix: correctly detect internal links when hash router is used #13296
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 2abef82 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 |
/index.html
as an internal link when hash router is used
preview: https://svelte-dev-git-preview-kit-13296-svelte.vercel.app/ this is an automated message |
/index.html
as an internal link when hash router is used/index.html
as an internal link when the hash router is used
/index.html
as an internal link when the hash router is used
Seems to still infinitely reload if we embed the app in an iframe using EDIT: I think we'll just deal with the embedded app html text case in a different PR as there are more compatibility issues to deal with first #13226 . Embedding through a URL src seems to work fine. |
This is great. I was going to raise an issue for this. '.../index.html/#/about' causes browser navigation in pages served by certain web servers. Would this change work for urls that have the page name other than |
This comment was marked as off-topic.
This comment was marked as off-topic.
No, because the hash router build currently always generates an
Yes, but you don't want to write all your links as |
This actually isn't documented at the moment, and it's not clear from the documentation how this interacts with the
So in the event someone has an "About this project" section on their home page with |
Sorry, I'm mistaken. The link should be
Yes, that will take you to authors section in the about page. Perhaps you can create a new issue and outline the hash router mechanics that require clarification in the documentation. |
fixes #13287
This PR fixes the client-side external link evaluation so that when using the hash router, accessing
/index.html
is considered an internal link. This prevents the page from reloading infinitely because the router incorrectly considered/index.html
an external link.There's also a slight doc change. Instead of suggesting all links start with
/#/
, suggesting links start with#
allows the router to preserve the/index.html
pathname. For example, links to/about
should be#/about
instead of/#/about
so that it navigates to/index.html#/about
.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.Edits