-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[docs] Fix warning and crash in dev mode #20623
[docs] Fix warning and crash in dev mode #20623
Conversation
317e525
to
6a20a9b
Compare
No bundle size changes comparing 72a477f...71f9f5e |
6a20a9b
to
71f9f5e
Compare
@@ -10,6 +10,10 @@ const requireRaw = require.context( | |||
/\.(js|md|tsx)$/, | |||
); | |||
|
|||
// Run styled-components ref logic |
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.
what is "ref logic"?
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.
They test that calling useRef crashes, however, we call it inside a React render method, hence, it warns.
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.
So it's not about "ref logic" but rather about where we instantiate the module (they could use any hook. useRef is just the fasted). Doing it during render triggers a false alarm in styled-components.
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.
Yes, you are right
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.
Yes, you are right
The crash can be reproduced on http://0.0.0.0:3000/components/autocomplete. I have seen warnings on these pages for a few months.
Related to styled-components/styled-components#2998