Open jmdarling opened 7 months ago
We have the same issue, but instead of CacheProvider
we are using:
createEmotion({key: 'default', nonce: 'nonce'}).css(styleObj);
Somehow we are getting some elements with key='css'
and without nonce
@jmdarling most likely you end up with multiple copies of @emotion/react
used in your app
@sshishov you'd have to create a repro for the problem and the separate issue for it to get further help on this one
@Andarist - I validated in my reproduction shared in this ticket that there is only a single copy of @emotion/react
. That was the first thing I thought too, but no dice.
@Andarist happens to us with Mantine v6, I double checked and the only version of @emotion/react
is used. At the same time mantine/styles
reexports createEmotionCache
@jmdarling did you find any workaround?
Current behavior:
My custom CacheProvider is not consistently "grabbing" styles imported from a library, resulting in injected
<style>
tags not having the expecteddata-emotion
attribute andnonce
attribute.To reproduce:
Reproduction repository: https://github.com/jmdarling/emotion-library-caching-issue
git clone https://github.com/jmdarling/emotion-library-caching-issue
npm install
npm run build
npm run dev
http://localhost:5173
Expected behavior:
My custom
CacheProvider
will properly "grab" styles imported from a library and I will see the correctdata-emotion
attribute andnonce
attribute on injected<style>
tags.Environment information:
react
version:18.2.0
@emotion/react
version:11.11.4