Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gatsby] Compare location object instead of just pathname #4292

Merged
merged 2 commits into from
Mar 2, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 { isEqual } from "lodash"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the shallow-compare package as we're already using that so it require any extra code

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 (isEqual(window.location, location)) {
return
}

Expand Down