Skip to content

Commit

Permalink
Use shared compare function.
Browse files Browse the repository at this point in the history
  • Loading branch information
guidobouman committed Jan 12, 2018
1 parent 37fa51a commit 2628214
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion modules/LocationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions modules/createBrowserHistory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import warning from "warning"
import invariant from "invariant"
import { createLocation } from "./LocationUtils"
import { createLocation, locationsAreEqual } from "./LocationUtils"
import {
addLeadingSlash,
stripTrailingSlash,
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions modules/createMemoryHistory.js
Original file line number Diff line number Diff line change
@@ -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) =>
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 2628214

Please sign in to comment.