From 88ac73a8412c264be48e4e80326f7a17d1dfdb39 Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Tue, 4 Oct 2022 10:55:13 -0700 Subject: [PATCH] Remove `@emotion/cache` usage from EuiProvider in favor of the default cache Emotion provides - which will automatically set compat = true --- .../provider/__snapshots__/provider.test.tsx.snap | 7 +++++++ src/components/provider/provider.tsx | 5 +---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/provider/__snapshots__/provider.test.tsx.snap b/src/components/provider/__snapshots__/provider.test.tsx.snap index b9a925d2c51..d83523850cd 100644 --- a/src/components/provider/__snapshots__/provider.test.tsx.snap +++ b/src/components/provider/__snapshots__/provider.test.tsx.snap @@ -20,6 +20,7 @@ exports[`EuiProvider applying modifications propagates \`modify\` 1`] = ` "key": "css", "nonce": undefined, "prepend": undefined, + "speedy": [Function], "tags": Array [], }, } @@ -379,6 +380,7 @@ exports[`EuiProvider changing color modes propagates \`colorMode\` 1`] = ` "key": "css", "nonce": undefined, "prepend": undefined, + "speedy": [Function], "tags": Array [], }, } @@ -727,6 +729,7 @@ exports[`EuiProvider is rendered 1`] = ` "key": "css", "nonce": undefined, "prepend": undefined, + "speedy": [Function], "tags": Array [], }, } @@ -1814,6 +1817,7 @@ exports[`EuiProvider providing an @emotion cache config applies the cache to glo "key": "css", "nonce": undefined, "prepend": undefined, + "speedy": [Function], "tags": Array [], }, } @@ -2184,6 +2188,7 @@ exports[`EuiProvider providing an @emotion cache config applies the cache to uti "key": "css", "nonce": undefined, "prepend": undefined, + "speedy": [Function], "tags": Array [], }, } @@ -2554,6 +2559,7 @@ exports[`EuiProvider providing an @emotion cache config provides a default cache "key": "css", "nonce": undefined, "prepend": undefined, + "speedy": [Function], "tags": Array [], }, } @@ -2901,6 +2907,7 @@ exports[`EuiProvider using \`null\` theme option does not add global styles 1`] "key": "css", "nonce": undefined, "prepend": undefined, + "speedy": [Function], "tags": Array [], }, } diff --git a/src/components/provider/provider.tsx b/src/components/provider/provider.tsx index 7fcebc9a280..84c2e662489 100644 --- a/src/components/provider/provider.tsx +++ b/src/components/provider/provider.tsx @@ -7,7 +7,7 @@ */ import React, { PropsWithChildren } from 'react'; -import createCache from '@emotion/cache'; +import { cache as fallbackCache } from '@emotion/css'; import { EmotionCache } from '@emotion/react'; import { @@ -28,9 +28,6 @@ const isEmotionCacheObject = ( obj: EmotionCache | Object ): obj is EmotionCache => obj.hasOwnProperty('key'); -const fallbackCache = createCache({ key: 'css' }); -fallbackCache.compat = true; - export interface EuiProviderProps extends Omit, 'children' | 'theme'>, EuiGlobalStylesProps {