From e426b1a3b9cf8f818d84e110fb664042025f68a7 Mon Sep 17 00:00:00 2001
From: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
Date: Wed, 14 Aug 2024 18:32:45 +0300
Subject: [PATCH] make local cypress dx great again (#46839)

---
 .../EmotionCacheProvider/EmotionCacheProvider.tsx         | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/frontend/src/metabase/styled-components/components/EmotionCacheProvider/EmotionCacheProvider.tsx b/frontend/src/metabase/styled-components/components/EmotionCacheProvider/EmotionCacheProvider.tsx
index 45a2ae712cf..4ba9e8af9b8 100644
--- a/frontend/src/metabase/styled-components/components/EmotionCacheProvider/EmotionCacheProvider.tsx
+++ b/frontend/src/metabase/styled-components/components/EmotionCacheProvider/EmotionCacheProvider.tsx
@@ -3,6 +3,8 @@ import { CacheProvider } from "@emotion/react";
 import type { ReactNode } from "react";
 import { useMemo } from "react";
 
+import { isCypressActive } from "metabase/env";
+
 interface EmotionCacheProviderProps {
   children?: ReactNode;
 }
@@ -11,7 +13,11 @@ export const EmotionCacheProvider = ({
   children,
 }: EmotionCacheProviderProps) => {
   const emotionCache = useMemo(() => {
-    const cache = createCache({ key: "emotion", nonce: window.MetabaseNonce });
+    const cache = createCache({
+      key: "emotion",
+      nonce: window.MetabaseNonce,
+      ...(isCypressActive && { speedy: true }),
+    });
     // This disables :first-child not working in SSR warnings
     // Source: https://github.com/emotion-js/emotion/issues/1105#issuecomment-557726922
     cache.compat = true;
-- 
GitLab