From 359439a32c87ac93b01ec230009a21ae263efe02 Mon Sep 17 00:00:00 2001 From: Michal Piechowiak Date: Mon, 1 Mar 2021 17:42:44 +0100 Subject: [PATCH] fix(gatsby): with some custom babel configs array spreading with Set is not safe --- .../fast-refresh-overlay/components/graphql-errors.js | 4 +++- .../fast-refresh-overlay/components/runtime-errors.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/gatsby/cache-dir/fast-refresh-overlay/components/graphql-errors.js b/packages/gatsby/cache-dir/fast-refresh-overlay/components/graphql-errors.js index dedd8a7667a2e..d534de7068549 100644 --- a/packages/gatsby/cache-dir/fast-refresh-overlay/components/graphql-errors.js +++ b/packages/gatsby/cache-dir/fast-refresh-overlay/components/graphql-errors.js @@ -59,7 +59,9 @@ function WrappedAccordionItem({ error, open }) { } export function GraphqlErrors({ errors, dismiss }) { - const deduplicatedErrors = React.useMemo(() => [...new Set(errors)], [errors]) + const deduplicatedErrors = React.useMemo(() => Array.from(new Set(errors)), [ + errors, + ]) const hasMultipleErrors = deduplicatedErrors.length > 1 return ( diff --git a/packages/gatsby/cache-dir/fast-refresh-overlay/components/runtime-errors.js b/packages/gatsby/cache-dir/fast-refresh-overlay/components/runtime-errors.js index 125767e4fb483..d9e76e97c1091 100644 --- a/packages/gatsby/cache-dir/fast-refresh-overlay/components/runtime-errors.js +++ b/packages/gatsby/cache-dir/fast-refresh-overlay/components/runtime-errors.js @@ -53,7 +53,9 @@ function WrappedAccordionItem({ error, open }) { } export function RuntimeErrors({ errors, dismiss }) { - const deduplicatedErrors = React.useMemo(() => [...new Set(errors)], [errors]) + const deduplicatedErrors = React.useMemo(() => Array.from(new Set(errors)), [ + errors, + ]) const hasMultipleErrors = deduplicatedErrors.length > 1 return (