vue-router: Hash mode places # at incorrect location in URL if current query parameters exist on page load
Version
3.0.1
Reproduction link
https://codesandbox.io/s/zlvz65rplp
Steps to reproduce
Navigate to myapp.com?foo=bar
What is expected?
Hash is appended before query parameters, to get the final result of myapp.com/#/?foo=bar
What is actually happening?
Hash is placed after parameters myapp.com?foo=bar#/ (also making the query parameters inaccessible with this.$route.query)
Note on codesandbox link - unable to place query parameter for initial URL in editor preview - please remove /#/ & append ?foo=bar
Running across this in an instance where user authentication is done outside our app, but client/user identifier is passed to our app in query parameter upon authorization.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 14
- Comments: 21 (7 by maintainers)
Commits related to this issue
- Fix "#" placed incorrectly when query string is present on load (#2125) When navigating to a URL with a query string like myapp.com?foo=bar in hash mode, the hash is currently placed after the query ... — committed to devin-brenton/vue-router by devin-brenton 6 years ago
- fix(hash): corerctly place query if placed before hash Fixes #2125 Closes #2262 — committed to vuejs/vue-router by posva 5 years ago
- fix(hash): correctly place query if placed before hash (#2851) Fixes #2125 Closes #2262 — committed to vuejs/vue-router by posva 5 years ago
I’m also having this same issue when trying to use oauth with github. My callback url is set to
https://myurl.com/#/in github and when I get redirected it’s still redirecting me tohttps://myurl.com?code=1234567890#/