-
Notifications
You must be signed in to change notification settings - Fork 49.7k
[DevTools] [Context] Legacy Context #16617
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
[DevTools] [Context] Legacy Context #16617
Conversation
|
Is it possible to add some sort of a test? |
Tests ✅ |
|
@gaearon Did you manage to check the tests? |
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.
Thanks! This looks nice. :)
| canViewSource = true; | ||
| if (stateNode && stateNode.context != null) { | ||
| context = stateNode.context; | ||
| const shouldHideContext = |
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.
This could probably use an explanatory inline comment. (I'll add one.)
| import type {FrontendBridge} from 'react-devtools-shared/src/bridge'; | ||
| import type Store from 'react-devtools-shared/src/devtools/store'; | ||
| import React, {Component, createContext} from 'react'; | ||
| import {Fragment} from '../../../../../../../../../../Applications/WebStorm.app/Contents/plugins/JavaScriptLanguage/jsLanguageServicesImpl/flow/react'; |
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.
😆
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.
Freakin' WebStorm 😆 #NeverTrustYourEditor
What's this comment about? Is this PR safe to merge or do we need to check on something first? |
|
I think this was meant as “@gaearon can you review again now that tests were added”. Lgtm |
| canViewSource: type === ElementTypeClass || type === ElementTypeFunction, | ||
|
|
||
| // Only legacy context exists in legacy versions. | ||
| hasLegacyContext: 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.
Should we also hide empty one though in the legacy mode?
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.
This value isn't used to hide the context label in the front end.. It just specifies whether the context is modern vs legacy. I guess it's a little weird to have a boolean value for this. Maybe we should use an enum? context type: none, modern, legacy.
Anyway, an empty legacy context won't be shown on the frontend because the InspectedElementTree component hides itself if the value it's passed is null or an empty object.
Fixes: #16466 and #16679
Description:
We are now changing the context label in DevTools based on if the component is using the legacy way of adding context.