You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has an unfortunate side effect of creating a race condition between any other imperative code (e.g. a Canvas rendering component) that may want to read the current CSS variables. This code cannot run before the code above or it will read previous/stale values.
We should refactor this code to declaratively share theme variables to its subtree, e.g.:
functionThemeProvider({ value, children }){// ...return(<ThemeContext.Providervalue={theme}><divstyle={{'--color-attribute-name': '#ef6632','--color-attribute-name-not-editable': '#23272f',// ...}}>{children}</div></ThemeContext.Provider>);}
We will also need to update any place that reads these computed styles, e.g.
I've added the "good first issue (taken)" label so that others will know not to start work on the issue. If you change your mind about the issue, no worries! Just let me know so that I can remove the label and free it up for someone else to claim.
DevTools defaults a "light" and a "dark" theme in a root-level CSS file:
react/packages/react-devtools-shared/src/devtools/views/root.css
Lines 1 to 188 in 3101872
The current theme value ("light", "dark", or "auto") is stored in the
ThemeContext
and persisted between sessions using thelocalStorage
API:react/packages/react-devtools-shared/src/devtools/views/Settings/SettingsContext.js
Lines 86 to 89 in 3101872
When the theme changes, a layout effect updates root-level CSS variables:
react/packages/react-devtools-shared/src/devtools/views/Settings/SettingsContext.js
Lines 149 to 163 in 3101872
This has an unfortunate side effect of creating a race condition between any other imperative code (e.g. a Canvas rendering component) that may want to read the current CSS variables. This code cannot run before the code above or it will read previous/stale values.
We should refactor this code to declaratively share theme variables to its subtree, e.g.:
We will also need to update any place that reads these computed styles, e.g.
react/packages/react-devtools-shared/src/devtools/views/Settings/SettingsContext.js
Lines 274 to 281 in 3101872
A similar approach is used for font size ("comfortable" or "compact"). We should do the same refactor for this.
The text was updated successfully, but these errors were encountered: