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

[BUGFIX release] Correctly update URL after browser popstate #10805

Merged
merged 1 commit into from Apr 2, 2015

Conversation

tomdale
Copy link
Member

@tomdale tomdale commented Apr 2, 2015

This commit partially reverts 7afdc41, which introduced a regression in the way HistoryLocation works.

Prior to the above-mentioned commit, we would always consult the browser’s state stack when determining what the current path was.

The one exception to this was in cases where HistoryLocation was used in browsers that do not support the history API. In that case, the in line comments described a fallback “polyfill” for tracking state.

Our rationale behind the refactor was that, if we have a fallback path anyway, we should just always use that instead of having two paths through the system.

In reality, the fallback path was a lower-fidelity implementation. In particular, there was no handling of the user hitting the back button, which generates a popstate event.

This commit reverts to the old behavior, so if the browser supports history state, we always check its current state when setting the URL. This makes sure that the path is correctly determined even if the user hit the back button, rather than using the last cached set value.

Fixes #10801.

@tomdale
Copy link
Member Author

tomdale commented Apr 2, 2015

/cc @mutewinter

@rwjblue Is there anything special I need to do with prefixing the commit?

This commit partially reverts 7afdc41,
which introduced a regression in the way HistoryLocation works.

Prior to the above-mentioned commit, we would always consult the browser’s state stack when determining what the current path was.

The one exception to this was in cases where HistoryLocation was used
in browsers that do not support the history API. In that case, the in line comments described a fallback “polyfill” for tracking state.

Our rationale behind the refactor was that, if we have a fallback path
anyway, we should just always use that instead of having two paths
through the system.

In reality, the fallback path was a lower-fidelity implementation.
In particular, there was no analog to the user hitting the back button,
which generates a popstate event.

This commit reverts to the old behavior, so if the browser supports
history state, we always check its current state when setting the URL.
This makes sure that the path is correctly determined even if the user
hit the back button, rather than using the last cached set value.

Fixes #10801
@rwjblue rwjblue changed the title [BUGFIX beta] Correctly update URL after browser popstate [BUGFIX release] Correctly update URL after browser popstate Apr 2, 2015
@rwjblue
Copy link
Member

rwjblue commented Apr 2, 2015

Rebased and updated commit prefix to [BUGFIX release].

rwjblue added a commit that referenced this pull request Apr 2, 2015
[BUGFIX release] Correctly update URL after browser popstate
@rwjblue rwjblue merged commit 0a02edd into master Apr 2, 2015
@rwjblue rwjblue deleted the fix-router-regression branch April 2, 2015 14:58
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.

Ember 1.11.0 Regression: URL Not Updated When Visiting Same Route Twice When Using HistoryLocation
2 participants