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

Remove Legacy Context API #13676

Closed
pungggi opened this issue Apr 27, 2019 · 16 comments
Closed

Remove Legacy Context API #13676

pungggi opened this issue Apr 27, 2019 · 16 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more. status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@pungggi
Copy link

pungggi commented Apr 27, 2019

Summary

Running my App in React.StrictMode brings the following

Warning: Legacy context API has been detected within a strict-mode tree: 
    in StrictMode (at gatsby-browser.js:10)
    in _default

Please update the following components: ScrollContext

Learn more about this warning here:
https://fb.me/react-strict-mode-warnings

Basic example

ScrollContext.childContextTypes = childContextTypes

Motivation

Use the new Context API all over to try out Concurrent Mode now and to be prepared for React 17.
https://reactjs.org/docs/legacy-context.html

@DSchau DSchau added the type: bug An issue or pull request relating to a bug in Gatsby label May 1, 2019
@DSchau
Copy link
Contributor

DSchau commented May 1, 2019

@pungggi you've done a great job debugging where this issue occurs.

Would you be interested in making this change? Context was introduced in React 16.3, and our minimum supported version of React is 16.4.2, so we can make this change.

We'd love a PR! Thank you!

@DSchau DSchau added the status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. label May 1, 2019
@paschalidi
Copy link
Contributor

@DSchau and @pungggi 👋!

This looks like a nice issue ! Can I please take over and start working on it? Asking since if @pungggi who reported want to work on this that is absolutely understandable.

Thanks for reporting @pungggi and thanks for taking good care of this @DSchau!

@DSchau
Copy link
Contributor

DSchau commented May 1, 2019

@paschalidi that'd be great! A unit test validating the fix to go along with it would be 👌 as well.

Let us know if we can help at all!

@paschalidi
Copy link
Contributor

@DSchau cool! Thanks for the quick response! Will open a PR the soonest! 👍

@paschalidi
Copy link
Contributor

@pungggi hey 👋, thanks from my side as well for reporting this.
I am looking a little bit onto this, could you maybe help me by explaining how to reproduce it?

What I have done is that I created a completely new gatsby app
with gatsby new my-blazing-fast-site
and then run gatsby develop from the root folder of the project.
Also have wrapped the whole app with the React.StrictMode.

This however will not give me the warning you are getting.
Explaining what you have done to get the warning will help a lot!

Thanks! 🙇

@pungggi
Copy link
Author

pungggi commented May 2, 2019

hi @paschalidi you might need to import from reach-router
for example
import { navigate } from "@reach/router"
or a Link I guess
import { Link } from "gatsby"

@pungggi
Copy link
Author

pungggi commented May 2, 2019

I`ve wrapped with
grafik

but I think it is the same effect as React.StrictMode ..

@paschalidi
Copy link
Contributor

Thanks!

@paschalidi
Copy link
Contributor

Hey @pungggi and @DSchau 👋 hope you both are doing fine and that you also having a good time!

Hmmm, it looks to me that I still cant reproduce the warning. To clear this out, I would very kindly ask you to check this repo https://github.com/paschalidi/gatsby-issue-13676.

Can please one of you clone it and run it locally and see if you can reproduce the same warning?
That would be amazing!! 🕊

@pungggi
Copy link
Author

pungggi commented May 4, 2019

@paschalidi
Just add this code to gatsby-browser.js

import React from "react"

export const wrapRootElement = ({ element }) => {
  return (
    <React.unstable_ConcurrentMode>{element}</React.unstable_ConcurrentMode>
  )
}

@paschalidi
Copy link
Contributor

paschalidi commented May 9, 2019

little bit busy the last days will work on that in the weekend. apologies

@gatsbot
Copy link

gatsbot bot commented May 30, 2019

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label May 30, 2019
@gatsbot
Copy link

gatsbot bot commented Jun 10, 2019

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community!

@gatsbot gatsbot bot closed this as completed Jun 10, 2019
@ericmasiello
Copy link

Can we reopen this?

@DSchau
Copy link
Contributor

DSchau commented Dec 16, 2019

@ericmasiello sure -- would you like to tackle the work required? It seems reasonably well scoped out!

@simnalamburt
Copy link

For those who reached here to enable strict mode in Gatsby, discussion of gatsby-react-router-scroll is being continued at #21231, and a PR regarding this issue has been opened! #21626

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

5 participants