history navigation fix following addition of decodeURI in rawth #158
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a follow-up on issue #155: now that router paths are decoded, the comparison logic in dom.js is broken for URLs containing spaces:
In the example above
url
is decoded, butloc.href
is not. This causes the following browser history navigation failure in my case:/
/my space
using<a href="/my space">link</a>
/
my space
againI eventually realized that the first 'forward' resulted in a push to
/my%20space
, which prompted to code above to add one more page/my space
to history. Clicking'back' then restores/my%20space
, causing again the/my space
entry to be added.This PR wraps
loc.href
above withdecodeURI()
. I tried to review all usages oflocation.href
, which prompted me to also factorize further togetLocation()
all accesses towindow.location
. My understanding is thatgetLocation()
is not exported from the router, hence the change of (default) behavior is ok.Side-question: should
rawth
not be usingdecodeURI
instead ofdecodeURIComponent
? (as it is applied to multiple components)