From 90dd016c367a19276217ad079c74414bd4ff6788 Mon Sep 17 00:00:00 2001 From: Viraj-10 Date: Wed, 7 Dec 2022 16:55:04 +0530 Subject: [PATCH] fix: use responsive query queryhash --- .../useResponsiveQuery/useResponsiveQuery.web.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/utils/useResponsiveQuery/useResponsiveQuery.web.tsx b/src/utils/useResponsiveQuery/useResponsiveQuery.web.tsx index c4f9c9dc1..33d23fbce 100644 --- a/src/utils/useResponsiveQuery/useResponsiveQuery.web.tsx +++ b/src/utils/useResponsiveQuery/useResponsiveQuery.web.tsx @@ -123,6 +123,7 @@ const getResponsiveStyles = ( queries: GetResponsiveStylesParams ): GetResponsiveStylesReturnType => { const queryString = stableHash(queries.query); + const queriesHash = hash(queryString); const styles = queries.initial @@ -168,8 +169,13 @@ const getResponsiveStyles = ( }); if (mediaRules) { const mediaQueryRule = getMediaQueryRule(queryRule, mediaRules); - insert(`/*${queryHash}{}*/${mediaQueryRule}`); - textContentMap[`/*${queryHash}{}*/${mediaQueryRule}`] = true; + + const queryKey = `/*${queryHash}{}*/${mediaQueryRule}`; + + if (!textContentMap[queryKey]) { + insert(queryKey); + textContentMap[queryKey] = true; + } } } });