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

Warn about legacy context when legacy context is not disabled #30297

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

kassens
Copy link
Member

@kassens kassens commented Jul 9, 2024

For environments that still have legacy contexts available, this adds a warning to make the remaining call sites easier to locate and encourage upgrades.

Copy link

vercel bot commented Jul 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 10, 2024 3:44pm

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jul 9, 2024
@kassens kassens force-pushed the pr30297 branch 2 times, most recently from 64eb3f3 to d74094d Compare July 9, 2024 19:27
@kassens kassens requested review from eps1lon and jackpope July 9, 2024 19:32
@kassens kassens force-pushed the pr30297 branch 3 times, most recently from 74fa741 to 59752f7 Compare July 10, 2024 00:27
@kassens
Copy link
Member Author

kassens commented Jul 10, 2024

Lol, quite a whack-a-mole, but tests pass now. Wish it was easier to see all the tests failing on the last run.

Let me know if that makes sense, ready for review!

@@ -426,6 +426,22 @@ function checkClassInstance(workInProgress: Fiber, ctor: any, newProps: any) {
name,
);
}
if (ctor.childContextTypes && !didWarnAboutChildContextTypes.has(ctor)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Code copied from line 392-407 above

@@ -403,6 +403,22 @@ function checkClassInstance(instance: any, ctor: any, newProps: any) {
name,
);
}
if (ctor.childContextTypes && !didWarnAboutChildContextTypes.has(ctor)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

copied from line 369-384 above

Copy link
Collaborator

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

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

Link to docs from the error: https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-removing-legacy-context?

Though the docs are missing that legacy context was also supported on function Components.

@kassens
Copy link
Member Author

kassens commented Jul 10, 2024

Though the docs are missing that legacy context was also supported on function Components.

I didn't even know that before seeing the code. Not sure if it was ever broadly communicated as legacy context was deprecated around the time of introduction of function components, IIRC.

For environments that still have legacy contexts available, this adds a warning to make the remaining call sites easier to locate and encourage upgrades.
@kassens kassens merged commit 378b305 into facebook:main Jul 10, 2024
138 checks passed
@kassens kassens deleted the pr30297 branch July 10, 2024 15:53
github-actions bot pushed a commit that referenced this pull request Jul 10, 2024
For environments that still have legacy contexts available, this adds a
warning to make the remaining call sites easier to locate and encourage
upgrades.

DiffTrain build for commit 378b305.
github-actions bot pushed a commit that referenced this pull request Jul 10, 2024
For environments that still have legacy contexts available, this adds a
warning to make the remaining call sites easier to locate and encourage
upgrades.

DiffTrain build for [378b305](378b305)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants