Skip to content
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: createBrowserHistory's createHref option #1442

Closed

Conversation

hi-ogawa
Copy link

@hi-ogawa hi-ogawa commented Apr 8, 2024

Related to my comment at the bottom of #1441 (comment), this looks to me like a minor typo.

It looks like createHref option is not currently used by @tanstack/react-router itself and I'm actually not sure what's the main use case, but as explained in the issue comment, I'm thinking to use this to fix history location encoding issue on my framework.

Please let me know if I missed something. Also I wasn't sure where a test belong to (or whether a new test is needed), so any pointers about testing would be appreciated. Thanks!

@hi-ogawa
Copy link
Author

hi-ogawa commented Apr 8, 2024

I came to realize that this is not a typo and it's very much intended not to do currentLocation = parseHref(createHref(destHref), ...).

The reason being, I think createHref and parseLocation work in a following way:

  • createHref: (application href) --> (actual browser href)
  • parseLocation: (actual browser state) -> (application location object)

For example, this architecture will probably allow pre-pending base path, which are not visible to application. Doing currentLocation = parseHref(createHref(destHref), ...)) will break such feature.

I'm happy to close this PR, but it would be awesome if someone from the team can confirm if my reasoning is correct.

@hi-ogawa hi-ogawa closed this Apr 8, 2024
@hi-ogawa hi-ogawa deleted the fix-createBrowserHistory-createHref branch April 8, 2024 05:00
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.

None yet

1 participant