From 471b319b86e0d5c1dfd694b2804b81a80d67184c Mon Sep 17 00:00:00 2001 From: Dunqing Date: Fri, 17 Mar 2023 11:04:29 +0800 Subject: [PATCH] fix(plugin-map): map block repeats (#1582) * fix: map block repeats * feat: update logic --- packages/plugins/map/src/client/block/index.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/plugins/map/src/client/block/index.tsx b/packages/plugins/map/src/client/block/index.tsx index 365373dad..26639663e 100644 --- a/packages/plugins/map/src/client/block/index.tsx +++ b/packages/plugins/map/src/client/block/index.tsx @@ -18,12 +18,14 @@ export const MapBlockOptions: React.FC = (props) => { const schemaInitializer = useContext(SchemaInitializerContext); useEffect(() => { - children.push({ - key: 'mapBlock', - type: 'item', - title: generateNTemplate('Map'), - component: 'MapBlockInitializer', - }); + if (!children.find((item) => item.component === 'MapBlockInitializer')) { + children.push({ + key: 'mapBlock', + type: 'item', + title: generateNTemplate('Map'), + component: 'MapBlockInitializer', + }); + } }, []); return (