From a00533ecad7f0721af1103d62a6deb48320d1e87 Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Thu, 9 Dec 2021 12:25:12 +1100 Subject: [PATCH] Tidy up settings useMemo Co-authored-by: Ramon --- .../block-editor/src/components/block-preview/index.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/block-editor/src/components/block-preview/index.js b/packages/block-editor/src/components/block-preview/index.js index e8ea15edf9271e..b43d8e9a74abd2 100644 --- a/packages/block-editor/src/components/block-preview/index.js +++ b/packages/block-editor/src/components/block-preview/index.js @@ -97,11 +97,10 @@ export function useBlockPreview( { ); const disabledRef = useDisabled(); const ref = useMergeRefs( [ props.ref, disabledRef ] ); - const settings = useMemo( () => { - const _settings = { ...originalSettings }; - _settings.__experimentalBlockPatterns = []; - return _settings; - }, [ originalSettings ] ); + const settings = useMemo( + () => ( { ...originalSettings, __experimentalBlockPatterns: [] } ), + [ originalSettings ] + ); const renderedBlocks = useMemo( () => castArray( blocks ), [ blocks ] ); const children = (