Open kof opened 7 years ago
I like this solution way better than tagging styles with $isDynamic
and having to chase that through the codebase.
Definitely, that isDynamic thing was a harsh decision, which is already removed in https://github.com/cssinjs/jss/pull/615. This issue is about to remove further checks of the link
option. It requires touching a number of plugins tests, thats why separate issue.
For dynamic styles/rules we need to allow them render empty in order to be linked and so props can be defined later. Right now the logic allows empty rules only if link: true option is used, which works fine.
Though, a more straight forward way would be to always allow empty rules. We need to skip empty rules only when we do SSR or build-time extraction in order to remove unused CSS.
Empty rules could be generated when a function which returns styles, but, based on some condition, returns an empty value and user is unaware. In general it is a quite rare case and gave us headaches with dynamic cases where rules are generated by Observables and evtl. by functions in the future.