diff --git a/modules/LocationUtils.js b/modules/LocationUtils.js index bc3d50c85..727209481 100644 --- a/modules/LocationUtils.js +++ b/modules/LocationUtils.js @@ -72,5 +72,4 @@ export const locationsAreEqual = (a, b) => a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && - a.key === b.key && valueEqual(a.state, b.state) diff --git a/modules/createBrowserHistory.js b/modules/createBrowserHistory.js index 2ac82f58b..1de1d37ff 100644 --- a/modules/createBrowserHistory.js +++ b/modules/createBrowserHistory.js @@ -1,6 +1,6 @@ import warning from "warning" import invariant from "invariant" -import { createLocation } from "./LocationUtils" +import { createLocation, locationsAreEqual } from "./LocationUtils" import { addLeadingSlash, stripTrailingSlash, @@ -165,7 +165,7 @@ const createBrowserHistory = (props = {}) => { const action = "PUSH" const location = createLocation(path, state, createKey(), history.location) - if (createPath(location) === createPath(history.location)) { + if (locationsAreEqual(location, history.location)) { replace(path, state) return } diff --git a/modules/createMemoryHistory.js b/modules/createMemoryHistory.js index 7afcab952..6bcb53dfc 100644 --- a/modules/createMemoryHistory.js +++ b/modules/createMemoryHistory.js @@ -1,6 +1,6 @@ import warning from "warning" import { createPath } from "./PathUtils" -import { createLocation } from "./LocationUtils" +import { createLocation, locationsAreEqual } from "./LocationUtils" import createTransitionManager from "./createTransitionManager" const clamp = (n, lowerBound, upperBound) => @@ -58,7 +58,7 @@ const createMemoryHistory = (props = {}) => { const action = "PUSH" const location = createLocation(path, state, createKey(), history.location) - if (createPath(location) === createPath(history.location)) { + if (locationsAreEqual(location, history.location)) { replace(path, state) return }