Skip to content
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

[withStyles] Limit stylesFn result caching to the client #231

wants to merge 1 commit into
base: master


Copy link

commented Sep 11, 2019


Limit styleFn results caching to the client so that styles are always recalculated server-side, since this optimization is not required.


@ljharb @ahuth @TaeKimJR @indiesquidge @joeuy

src/withStyles.jsx Outdated Show resolved Hide resolved

@noratarano noratarano changed the title Nora client server diffs [withStyles] Limit stylesFn result caching to the client Sep 11, 2019

@noratarano noratarano force-pushed the nora--client-server-diffs branch from fa560ea to 3b96e10 Sep 11, 2019


This comment has been minimized.

Copy link
Contributor Author

commented Sep 11, 2019

@@ -109,9 +109,13 @@ export function withStyles(
// Get and store the result in the stylesFnResultsCache for the component
// -- not the instance -- so we only apply the theme to the stylesFn
// once per theme for this component.
const cachedResultForTheme = stylesFnResultCacheMap.get(theme);
const isClient = typeof window !== 'undefined';

This comment has been minimized.

Copy link

ljharb Sep 11, 2019


will this result in a different initial client render, compared to the server render?

This comment has been minimized.

Copy link

noratarano Sep 11, 2019

Author Contributor

🤔 I was worried about that. I should test that scenario. Let me get back to you about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.