Skip to content

Commit

Permalink
fix(editor): Prune values that are not in the schema in the ResourceM…
Browse files Browse the repository at this point in the history
…apper component (#8478)
  • Loading branch information
elsmr authored and netroy committed Feb 2, 2024
1 parent 98ea7d4 commit d0e94b0
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,15 +430,17 @@ function emitValueChanged(): void {
}
function pruneParamValues(): void {
if (!state.paramValue.value) {
const { value, schema } = state.paramValue;
if (!value) {
return;
}
const valueKeys = Object.keys(state.paramValue.value);
valueKeys.forEach((key) => {
if (state.paramValue.value && state.paramValue.value[key] === null) {
delete state.paramValue.value[key];
const schemaKeys = new Set(schema.map((s) => s.id));
for (const key of Object.keys(value)) {
if (value[key] === null || !schemaKeys.has(key)) {
delete value[key];
}
});
}
}
defineExpose({
Expand Down

0 comments on commit d0e94b0

Please sign in to comment.