Skip to content

Commit

Permalink
[gatsby] Compare location object instead of just pathname (#4292)
Browse files Browse the repository at this point in the history
* Compare location object instead of just pathname

* Use shallowCompare
  • Loading branch information
paulathevalley authored and KyleAMathews committed Mar 2, 2018
1 parent afa6a5c commit 9b35ece
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/gatsby/cache-dir/production-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import history from "./history"
window.___history = history
import emitter from "./emitter"
window.___emitter = emitter
import shallowCompare from "shallow-compare"
import pages from "./pages.json"
import redirects from "./redirects.json"
import ComponentRenderer from "./component-renderer"
Expand Down Expand Up @@ -62,8 +63,8 @@ apiRunnerAsync(`onClientEntry`).then(() => {
pathname = redirect.toPath
}

// If we're already at this path, do nothing.
if (window.location.pathname === pathname) {
// If we're already at this location, do nothing.
if (shallowCompare(window.location, location)) {
return
}

Expand Down

0 comments on commit 9b35ece

Please sign in to comment.