You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Server side rendering breaks if you after styleSheet.reset() #378
I can confirm this issue.Also happens on master if you call styleSheet.flush().
I think this happens because components are imported once in the server so the ComponentStyle constructor, which calls inject() on the styleSheet, is also called once for every styled component. reset() clears all cssRules on the stylesheet and the components are left with dangling pointers to previous rule entries.
I will look more into it when i got the time and provide some feedback.
Activity
mxstbr commentedon Jan 14, 2017
Thanks for testing the v2 branch, much appreciated!
/cc @ThisGuyChris any ideas what's up here?
teonik commentedon Jan 14, 2017
I can confirm this issue.Also happens on
masterif you call styleSheet.flush().I think this happens because components are imported once in the server so the
ComponentStyleconstructor, which callsinject()on the styleSheet, is also called once for every styled component.reset()clears all cssRules on the stylesheet and the components are left with dangling pointers to previous rule entries.I will look more into it when i got the time and provide some feedback.
geelen commentedon Jan 15, 2017
Ah yep I put in a cache in
ComponentStyle. That should be moved across toStyleSheetand cleared when you call reset. I'd do it but I'm on my phone :)add cache in SSR class
wmertens commentedon Mar 9, 2017
in the mean time, you can do SSR by simply not calling
reset()😄 . It's a little less efficient byte-wise but not terrible.wmertens commentedon Mar 30, 2017
My little workaround results in weird styles after a while :( I'd like to see this fixed before we go into production, soon.
@geelen is fixing this really as easy as moving a cache var to a different place or does it mean updating the code all over the place?
mxstbr commentedon Apr 1, 2017
This will be fixed with the new API I'm pretty sure (ref #386) since you won't need to call
resetanymore.seidtgeist commentedon Apr 14, 2017
Would you accept a fix for
reset()in an interim 2.0.0-xx release until #386 has replaced the current API?mxstbr commentedon Apr 14, 2017
Sure!
seidtgeist commentedon Apr 15, 2017
@geelen Could you nudge me in the right direction here? I saw @ThisGuyChris’s commit but it breaks the
styleSheet.reset()test.