Closed fastfedora closed 3 years ago
Hi @fastfedora,
Apologies for the slow response.
There were two issues that needed to be resolved:
<style>
content<style>
content changes made by styled-components
.Both of these issues have been addressed in #140. A new version will be released shortly.
All fixed in 2.4.0, @fastfedora.
I just inherited a project that is using
css-vars-ponyfill
withstyled-components
. Upgrading to the latest version ofcss-vars-ponyfill
broke some of the CSS that is being generated dynamically.Here's a simplified version of a component I was able to track the issue down to:
As you can see, the style for this component can change whenever the
value
ordisabled
props change.Before version 2.3.0, the style would be retransformed each time it changed. Starting with version 2.3.0, this does not happen.
I suspect the issue is this line which disables the sheet if
preserveStatic
is set totrue
. Indeed, settingpreserveStatic
tofalse
appears to fix the issue. However, it seems like setting this tofalse
has several other side effects.As I'm just getting started on this project, I can't yet tell if there are other unintended consequences from setting this to
false
. Should there be an additional flag to maintain the preserve static behavior, but allow dynamic CSS?My guess is that part of the issue is that
styled-components
is replacing the CSS in the original sheet, and not appending a new one. So once the sheet has been disabled, and thenstyled-components
re-renders that CSS with the--var
statements, the new code is never transformed.