From 3ae8110f740db682b20e1ddc10f8ef4d83bb21e3 Mon Sep 17 00:00:00 2001 From: Tim Dorr Date: Tue, 2 Feb 2016 21:29:18 -0500 Subject: [PATCH] Compare location changes against initialState. 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 --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index cc19dd7..8c62ec8 100644 --- a/src/index.js +++ b/src/index.js @@ -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 }