-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Log Fragment name when trying to render a lazy fragment #30372
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Comparing: 163365a...228669e Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js
Outdated
Show resolved
Hide resolved
@@ -1891,11 +1892,13 @@ function mountLazyComponent( | |||
} | |||
} | |||
|
|||
const loggedComponent = Component === REACT_FRAGMENT_TYPE ? '<Fragment>' : Component; |
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.
We can use getComponentNameFromType
from shared/getComponentNameFromType
here instead. That way we also get a better name for all the other types you're not supposed to use.
const loggedComponent = Component === REACT_FRAGMENT_TYPE ? '<Fragment>' : Component; | |
const loggedComponent = getComponentNameFromType(Component) || String(Component); |
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.
Forgot that we use + ''
for perf so || (Component + '')
it is.
Co-authored-by: Sebastian Silbermann <[email protected]>
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
Prettier and lint failing. |
@eps1lon I chose to ignore the string coercion lint, let me know if that's not ok and I can find a different way forward - probably by introducing a new string coercion check function for components? |
Let's just be simple about it and do what the lint rule asks. |
Seems like common practice though. |
What solution are you thinking of? The lint rule asks to use a "checkXxxxxStringCoercion" function but none exists for components right now, which is why I suggested creating one. |
Just kept the original behavior. |
DiffTrain build for commit 9cc0f6e.
Summary
Fixes #26910
How did you test this change?
See test.