fix(plugin-map): map block repeats (#1582)

* fix: map block repeats

* feat: update logic
This commit is contained in:
Dunqing 2023-03-17 11:04:29 +08:00 committed by GitHub
parent f9b034b283
commit 471b319b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,12 +18,14 @@ export const MapBlockOptions: React.FC = (props) => {
const schemaInitializer = useContext(SchemaInitializerContext); const schemaInitializer = useContext(SchemaInitializerContext);
useEffect(() => { useEffect(() => {
if (!children.find((item) => item.component === 'MapBlockInitializer')) {
children.push({ children.push({
key: 'mapBlock', key: 'mapBlock',
type: 'item', type: 'item',
title: generateNTemplate('Map'), title: generateNTemplate('Map'),
component: 'MapBlockInitializer', component: 'MapBlockInitializer',
}); });
}
}, []); }, []);
return ( return (