fix(editor): Prune values that are not in the schema in the ResourceMapper component (#8478)

This commit is contained in:
Elias Meire
2024-02-02 11:28:12 +01:00
committed by GitHub
parent c419c8592f
commit 612771e032

View File

@@ -430,15 +430,17 @@ function emitValueChanged(): void {
} }
function pruneParamValues(): void { function pruneParamValues(): void {
if (!state.paramValue.value) { const { value, schema } = state.paramValue;
if (!value) {
return; return;
} }
const valueKeys = Object.keys(state.paramValue.value);
valueKeys.forEach((key) => { const schemaKeys = new Set(schema.map((s) => s.id));
if (state.paramValue.value && state.paramValue.value[key] === null) { for (const key of Object.keys(value)) {
delete state.paramValue.value[key]; if (value[key] === null || !schemaKeys.has(key)) {
delete value[key];
} }
}); }
} }
defineExpose({ defineExpose({