1
0
Fork 0
freesewing/packages/freesewing.shared/components
Joost De Cock bb901c4d8a fix(fs.dev): (hackish) workaround for theme prop update issue
This is a workaround for the following problem that I can't seem
to understand.

This JSX code:

<p data-theme={props.app.theme}>{props.app.theme}</p>

Is rendered as:

<p data-theme="light">dark</p>

This happens only upon initial page load because on the server
side we don't know the user's preferred theme. So we start with
the default (light).

Then, as the app bootstraps in the browser, it updated the content
of the P tag with the new theme (dark).
However, for reasons that I really don't understand, it does not
update the `data-theme` attribute.

So this works around that be forcing a different component for each
theme that has the data-theme hardcoded. By force-rendering a different
component, we can be certain React has no choice be to re-render the
entire tag.

If anybody could explain to me why this happen, I'd gladly buy you
a coffee or something.
2021-12-30 16:52:28 +01:00
..
icons feat(fs.dev): Ported icons to one file per icon 2021-12-27 14:30:10 +01:00
layouts wip(fs.dev): Troubleshooting SSR themeing issues 2021-12-30 14:23:02 +01:00
logos chore(fs.dev): Prebuild 2021-12-27 17:33:31 +01:00
mdx fix(fs.shared): Remove debug statement 2021-12-28 16:23:52 +01:00
navigation fix(fs.dev): Make sidebar dark as suggested by @hellgy 2021-12-29 18:58:20 +01:00
wrappers fix(fs.dev): (hackish) workaround for theme prop update issue 2021-12-30 16:52:28 +01:00
popout.js feat(fs.shared): Allow passing className to Popout 2021-12-28 16:11:46 +01:00
theme-picker.js wip(fs.dev): Troubleshooting SSR themeing issues 2021-12-30 14:23:02 +01:00