Skip to content

Commit 2a3582e

Browse files
KyleAMathewsryanflorence
authored andcommitted
[changed] make URLStore.push idempotent
If somebody’s component is observing some user input its easy to start pushing the same url into the store, this makes it so devs can kind of treat `Router.transitionTo` like rendering, nothing happens if nothing has changed. Previously, you get a bunch of history entries that don’t change UI as the user clicks the back button. closes #79
1 parent 97c02f1 commit 2a3582e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/stores/URLStore.js

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ var URLStore = {
6767
* Pushes the given path onto the browser navigation stack.
6868
*/
6969
push: function (path) {
70+
if (path === _currentPath)
71+
return;
72+
7073
if (_location === 'history') {
7174
window.history.pushState({ path: path }, '', path);
7275
notifyChange();

0 commit comments

Comments
 (0)