glamor icon indicating copy to clipboard operation
glamor copied to clipboard

Failing test and proposed fix for css({'data-css-nil': ''})

Open penx opened this issue 6 years ago • 7 comments

I can't see any documentation or explanation in the code as to what data-css-nil is for, other than:

https://github.com/threepointone/glamor/blob/db533d7c5fe249e443756367161d0830086b0624/src/index.js#L430-L432

...and some perhaps related discussion in issue #303.

However, Glamorous, under certain conditions, will call css({'data-css-nil': ''}), which causes Glamor to throw the following error:

Error: [glamor] an unexpected rule cache miss occurred. This is probably a sign of multiple glamor instances in your app. See https://github.com/threepointone/glamor/issues/79

See:

paypal/glamorous#396 paypal/glamorous#397

I am not sure if this bug is due to Glamorous sending something through that it shouldn't, or Glamor not handling this correctly, so have created failing tests for both scenarios.

I can't find references to data-css-nil in Glamorous' code base but can continue to debug to try find out what's causing this. However if anyone has any insight on this that may save a lot of code reading then please let me know 🙂

penx avatar Mar 21 '18 19:03 penx

Thanks for opening this! This is a great first step to figuring out what's up!

I personally don't have time to help with this, and I don't understand the inner-workings of glamor super-well, but hopefully someone can help.

kentcdodds avatar Mar 21 '18 20:03 kentcdodds

I was starting to understand it earlier. Will take another look tomorrow

penx avatar Mar 21 '18 20:03 penx

Seems like it was originally added to fix https://github.com/threepointone/glamor/issues/115

tikotzky avatar Mar 21 '18 21:03 tikotzky

I've added a proposed fix to this PR that makes build ignore rules where the ID is 'nil'

penx avatar Mar 22 '18 10:03 penx

Another scenario which would be handy to fix is glamorous(MyComponent)({}) throws the same error.

JakeGinnivan avatar Mar 24 '18 14:03 JakeGinnivan

Travis failure is unrelated:

22 03 2018 08:53:12.786:ERROR [launcher]: Cannot start Chrome [3353:3353:0322/085312.638592:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /opt/google/chrome/chrome-sandbox is owned by root and has mode 4755.

penx avatar Apr 10 '18 20:04 penx

Hey @penx, since we at Signavio believe in this library we want to continue developing it further. Therefore, we've forked it and will release it as signavio-glamor. It would be awesome if you could direct your PR against our fork so that we can include it!

https://github.com/signavio/glamor

frontendphil avatar Sep 25 '18 20:09 frontendphil