-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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: update createHref to be history-aware #9409
Conversation
🦋 Changeset detectedLatest commit: 3054115 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
…ophdawg11/create-href-fix
b87b1e9
to
60553bf
Compare
createHref, | ||
// Passthrough to history-aware createHref used by useHref so we get proper | ||
// hash-aware URLs in DOM paths | ||
createHref: (to: To) => init.history.createHref(to), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just an oversight. We have a local createHref
brought over from transition manager that creates a "server" URL without the hash, but the one we want to expose is the history-aware version so that hash routers properly generate <a href="#/path
> links
"<div> | ||
<div> | ||
<a | ||
href=\\"/bar\\" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the href-specific parts of these snapshots since href-generation is tested elsewhere. This way we can share these functional tests between createBrowserRouter
and createHashRouter
. Hiding whitespace makes this easier to see 😄
@@ -2723,7 +2725,7 @@ function findRedirect(results: DataResult[]): RedirectResult | undefined { | |||
} | |||
|
|||
// Create an href to represent a "server" URL without the hash | |||
function createHref(location: Partial<Path> | Location | URL) { | |||
function createServerHref(location: Partial<Path> | Location | URL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed this to avoid confusion
Fixes #9392