Don't overwrite when key already exists in map

This commit is contained in:
Misode
2023-03-09 21:28:18 +01:00
parent e50a6a04be
commit d6bce8b24a
+3 -1
View File
@@ -197,7 +197,9 @@ const renderHtml: RenderHook = {
const keyPath = new ModelPath(keysModel, new Path([hashString(path.toString())]))
const onAdd = () => {
const key = keyPath.get()
path.model.set(path.push(key), DataModel.wrapLists(children.default()))
if (path.model.get(path.push(key)) === undefined) {
path.model.set(path.push(key), DataModel.wrapLists(children.default()))
}
}
const blockState = config.validation?.validator === 'block_state_map' ? states?.[relativePath(path, config.validation.params.id).get()] : null
const keysSchema = blockState?.properties