cssinjs / jss

JSS is an authoring tool for CSS which uses JavaScript as a host language.
https://cssinjs.org
MIT License
7.06k stars 397 forks source link

[react-jss] injectSheet: detach static sheet from the sheet registry when needed #808

Open HenriBeck opened 5 years ago

HenriBeck commented 5 years ago

From @oliviertassinari on July 25, 2017 20:49

This issue is part of a series of feedbacks. I been upgrading the Material-UI solution. Unfortunately, I had to fork the package in order to reach my goal. Now, it's time to reconciliation.

The issue

Right now, a static sheet is never removed from the sheet registry. I have been using that feature for testing and demo purposes on Material-UI.

Copied from original issue: cssinjs/react-jss#131

HenriBeck commented 5 years ago

From @kof on July 28, 2017 16:33

Sheets registry remains forever on the client, but on the server user passes a new registry for each request.

Are you talking about the client side rendering? Why is that a problem?

HenriBeck commented 5 years ago

From @oliviertassinari on July 28, 2017 22:10

Here is an example of demo application of the detach on the client: sheet-registry. If you switch the ligh/dark mode you will see the counter value change.

HenriBeck commented 5 years ago

From @oliviertassinari on July 28, 2017 22:12

Here is another application of the detach but for test purposes.

HenriBeck commented 5 years ago

From @oliviertassinari on July 28, 2017 22:13

I think that it's just a matter of safety, things need to be cleanup in case.

HenriBeck commented 5 years ago

Is this still a problem? Even though the sheet might still be in the registry it will not be used unless a component needs it.