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

chore(gatsby-react-router-scroll): Remove legacy context #21626

Merged
merged 9 commits into from
May 6, 2020

Conversation

herecydev
Copy link
Contributor

Description

Replace legacy context with React 16.3 Context

Related Issues

Fixes #21231

@herecydev herecydev requested a review from a team as a code owner February 20, 2020 19:13
Comment on lines 92 to 96
value={{
registerElement: this.registerElement,
unregisterElement: this.unregisterElement,
scrollBehavior: this.scrollBehavior,
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this re-render child components whenever this component re-renders?
because a new object instance passed on each render.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you're right. Let me change to use this

@blainekasten
Copy link
Contributor

@herecydev This looks great! We're working on deciding a feature set and timeline for a v3. This is technically a major change as it breaks compatibility for consumers outside of that 16.3 range. Which ironically, this scroll container is used in more than just our codebase.

I think that since this is here to satisfy some warnings, we're going to pause this PR and consider making it part of V3

@blainekasten blainekasten added this to the Next Major milestone Feb 20, 2020
@wardpeet wardpeet added the breaking change If implemented, this proposed work would break functionality for older versions of Gatsby label Feb 21, 2020
@wardpeet wardpeet changed the title Remove legacy context chore(gatsby-react-router-scroll): Remove legacy context May 5, 2020
@wardpeet wardpeet merged commit 597491a into gatsbyjs:master May 6, 2020
@wardpeet
Copy link
Contributor

wardpeet commented May 6, 2020

Gatsby depends on React 16.4.3 so I published a major of this plugin as it's used internally in gatsby.

Available in gatsby@2.21.15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change If implemented, this proposed work would break functionality for older versions of Gatsby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StrictMode Error: Please update the following components: ScrollContext
4 participants