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
[Bug]: StrictMode breaks v9 theming #23625
Comments
Maybe React 18 related, not sure. (#22241) |
probably ID related. i repro'ed it with a base react 18 repro |
Issue comes down to how we inject styles into the DOM at render, but clean up on useEffect return. This approach is necessary because useEffect/useLayoutEffect is too slow to be injecting styles into the DOM without a ton of style recalculation. React 18 provides a useInsertionEffect that is tailor made to support CSS in JS libraries inserting styles into the document. The solution will be forking behavior and using the new hook when it is available. I have a prototype branch working now, and currently gathering feedback on the solution. |
@micahgodbolt current code can be simply refactored to use
This allows reduce amount of conditions & branches. Refactor can also remove need of
Edit: 👆 we can't as it's the actual source of the problem: rendering happens twice (we create
Do we have a confirmation for that? It sounds true for Griffel's case (it inserts tons of rules to elements, but it will cause recalculations even now as any insert to
|
Library
React Components / v9 (@fluentui/react-components)
System Info
Are you reporting Accessibility issue?
No response
Reproduction
https://codesandbox.io/s/nice-villani-7vgw53?file=/src/index.tsx
Bug Description
Actual Behavior
Ugly buttons
Expected Behavior
Pretty buttons (remove the
StrictMode
to see)Logs
No response
Requested priority
High
Products/sites affected
No response
Are you willing to submit a PR to fix?
no
Validations
The text was updated successfully, but these errors were encountered: