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

Properly handle hash URL changes. #996

Merged
merged 3 commits into from
Feb 5, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Get rid of RegExp for getUrl().
  • Loading branch information
arunoda committed Feb 5, 2017
commit a88ce98d8fa0365bf3f6cb9bc8961e560c465e55
2 changes: 1 addition & 1 deletion lib/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 284,7 @@ export default class Router extends EventEmitter {

function getURL () {
const { href, origin } = window.location
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have just # on the URL, window.location.hash simply shows a empty string.
So, we can't generate the correct URL.

But this method does that.

return href.replace(new RegExp(`^${origin}`), '')
return href.substring(origin.length)
}

function toRoute (path) {
Expand Down