Skip to content
This repository has been archived by the owner on Oct 26, 2018. It is now read-only.

Commit

Permalink
Compare location changes against initialState.
Browse files Browse the repository at this point in the history
Also, replace the location, rather than transitionTo it.

The location in the initialState is no longer undefined, so we should compare if we're going back to that state. Because the initial action is normally a POP, we can't transition to that kind of action and instead need to replace our location.

Fixes #164
Fixes #252
  • Loading branch information
timdorr committed Feb 3, 2016
1 parent c3dc895 commit 3ae8110
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export function syncHistory(history) {
// If we're resetting to the beginning, use the saved initial value. We
// need to dispatch a new action at this point to populate the store
// appropriately.
if (!location) {
history.transitionTo(initialLocation)
if (location.key === initialLocation.key) {
history.replace(initialLocation)
return
}

Expand Down

1 comment on commit 3ae8110

@gaearon
Copy link
Member

@gaearon gaearon commented on 3ae8110 Feb 3, 2016

Choose a reason for hiding this comment

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

I was just about to post

screen shot 2016-02-03 at 02 59 55

Thank you for looking into this!

Please sign in to comment.