paypal / glamorous

DEPRECATED: 💄 Maintainable CSS with React
https://glamorous.rocks
MIT License
3.64k stars 208 forks source link

Memory leak with slatejs #417

Closed matt-erhart closed 6 years ago

matt-erhart commented 6 years ago

Relevant code. <Span {...props} />;

What you did: Use a glamorous component in slatejs

What happened: Memory leak / browser crash.

Reproduction: https://codesandbox.io/s/409rxn0my7 index.js line 45-46. Be ready to crash your tab/browser.

Already posted to slatejs as I assume that's we're the trouble is. This does stop me from using glamorous here, and there's a slight chance it might help you track down some funky code. Styled components doesn't have this problem. Is glamorous passing in some extra prop that I need to block?

matt-erhart commented 6 years ago

The issue here was passing {...props} instead of attributes and children separately. Unlike like other components, Glamorous doesn't ignore slate things in ...props like editor etc. return <Span {...props} contentEditable={false} title='meta test' />; // work everywhere but glamorous return <Span {...props.attributes} contentEditable={false} title='meta test' > {props.children} ; // work everywhere