Skip to content
Snippets Groups Projects
Commit 17898ad5 authored by Matthias Konitzny's avatar Matthias Konitzny :fire:
Browse files

Improved logic for group node updates

parent 594da90d
No related branches found
No related tags found
No related merge requests found
......@@ -32,11 +32,11 @@ function NodeDetails({
const referenceData: NodeDataChangeRequest = {
id: -1,
name: getCollectiveValue((n) => n.name, ""),
description: getCollectiveValue((n) => n.description, ""),
video: getCollectiveValue((n) => n.video, ""),
icon: getCollectiveValue((n) => n.icon, ""),
banner: getCollectiveValue((n) => n.banner, ""),
name: getCollectiveValue((n) => n.name, undefined),
description: getCollectiveValue((n) => n.description, undefined),
video: getCollectiveValue((n) => n.video, undefined),
icon: getCollectiveValue((n) => n.icon, undefined),
banner: getCollectiveValue((n) => n.banner, undefined),
references: getCollectiveValue((n) => n.references, undefined),
type: getCollectiveValue((n) => n.type, undefined),
};
......@@ -46,9 +46,27 @@ function NodeDetails({
value: ValueType
) {
Object.assign(referenceData, { [key]: value });
onNodeDataChange(
selectedNodes.map((node) => {
return { ...referenceData, id: node.id, name: node.name };
const update = Object.fromEntries(
Object.entries(referenceData).filter(
([k, v]) => v !== undefined
)
);
const defaults = {
name: node.name,
description: node.description,
video: node.video,
icon: node.icon,
banner: node.banner,
references: node.references,
type: node.type,
};
return Object.assign({}, defaults, update, {
id: node.id,
});
})
);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment