From c9b1aefe3c87080904e537e9918b9d2ed4d48318 Mon Sep 17 00:00:00 2001 From: Ben Life Date: Wed, 19 Feb 2025 17:41:47 -0500 Subject: [PATCH] fix flickering --- .../components/InternalLayoutEditor.tsx | 68 ++++++++++--------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/packages/visual-editor/src/internal/components/InternalLayoutEditor.tsx b/packages/visual-editor/src/internal/components/InternalLayoutEditor.tsx index ea4f76d8..3650f66a 100644 --- a/packages/visual-editor/src/internal/components/InternalLayoutEditor.tsx +++ b/packages/visual-editor/src/internal/components/InternalLayoutEditor.tsx @@ -120,41 +120,45 @@ export const InternalLayoutEditor = ({ } }; - return ( - - ({ - label: "Title", - filter: { - types: ["type.string"], - }, - }), - description: YextEntityFieldSelector({ - label: "Description", - filter: { - types: ["type.string"], - }, - }), + const puckConfigWithRootFields = React.useMemo(() => { + return { + ...puckConfig, + root: { + ...puckConfig.root, + fields: { + title: YextEntityFieldSelector({ + label: "Title", + filter: { + types: ["type.string"], }, - defaultProps: { - title: { - field: "name", - constantValue: "", - constantValueEnabled: false, - }, - description: { - field: "description", - constantValue: "", - constantValueEnabled: false, - }, + }), + description: YextEntityFieldSelector({ + label: "Description", + filter: { + types: ["type.string"], }, + }), + }, + defaultProps: { + title: { + field: "name", + constantValue: "", + constantValueEnabled: false, }, - }} + description: { + field: "description", + constantValue: "", + constantValueEnabled: false, + }, + }, + }, + }; + }, [puckConfig]); + + return ( + +