-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Temp fix for scroll behavior problems #7758
Conversation
packages/gatsby-link/src/index.js
Outdated
@@ -151,6 +156,9 @@ class GatsbyLink extends React.Component { | |||
} | |||
} | |||
|
|||
// Temp hack while awaiting https://github.com/reach/router/issues/119 | |||
window.__navigatingToLink = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be in
const navigate = (to, options) => { |
Link
component to cover programmatic navigation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, and if it was moved there probably it should be in if (!option.replace)
(not entirely sure here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oo right, programmatic nav, forgot about that. Will switch over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and yeah, replacing shouldn't update the scroll
packages/gatsby-link/src/index.js
Outdated
if (typeof window !== `undefined`) { | ||
window.__navigatingToLink = false | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this to
function init() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
location.action = `push` | ||
|
||
// Temp hack while awaiting https://github.com/reach/router/issues/119 | ||
if (window.__navigatingToLink) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure this will work everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for suspecting it wouldn't?
Closes #7454