-
Notifications
You must be signed in to change notification settings - Fork 45.6k
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
refactor(getComponentName): Use element types instead of fiber types #15638
refactor(getComponentName): Use element types instead of fiber types #15638
Conversation
ReactDOM: size: 0.0%, gzip: 0.0% Details of bundled changes.Comparing: 07da821...899a0b3 react-dom
react-art
react-test-renderer
react-native-renderer
react-reconciler
Generated by 🚫 dangerJS |
// Host root, text node or just invalid type. | ||
return null; | ||
} | ||
if (__DEV__) { | ||
if (typeof (type: any).tag === 'number') { | ||
// TODO: protect against potential false positives from user-defined statics | ||
if (typeof (elementType: any).tag === 'number') { |
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.
The check was introduced in #13197. Seems like this was meant as a helper for the transition period since it was used on the full fiber previously.
It's probably better to remove this altogether. An unknown component name should appear in the tests leading to a fail instead of a different error message.
Using _debugID
is likely best to reduce the number of false positives.
Using isValidElementType
leads to breakage in the internal React.lazy tests.
8c1450f
to
3134205
Compare
3134205
to
899a0b3
Compare
899a0b3
to
5a6abe7
Compare
ReactDOM: size: 0.0%, gzip: 0.0% Details of bundled changes.Comparing: 980112b...73d54f5 react-art
react-dom
react-test-renderer
react-reconciler
react-native-renderer
|
5a6abe7
to
73d54f5
Compare
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
I'll resolve merge conflicts. |
73d54f5
to
08485d9
Compare
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b1f4a5c:
|
Details of bundled changes.Comparing: 9ea0f67...b1f4a5c react-dom
react-native-renderer
react-art
react-test-renderer
react-reconciler
ReactDOM: size: 0.0%, gzip: -0.1% Size changes (experimental) |
Details of bundled changes.Comparing: 9ea0f67...b1f4a5c react-dom
react-art
react-test-renderer
react-native-renderer
react-reconciler
ReactDOM: size: 0.0%, gzip: -0.1% Size changes (stable) |
31cb7e8
to
7e65fde
Compare
7e65fde
to
bda6a9b
Compare
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
bda6a9b
to
b1f4a5c
Compare
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
Closing due to missing interest. |
Since fiber types can change during work (see MemoComponent -> SimpleMemoComponent) it seems more appropriate to use the elementType instead to determine a component name.
Makes #15313 easier (see #15313 (comment)). It would also enable #14319 since we no longer rely on internal data structures (fiber types) but public element types.