Skip to content

Commit

Permalink
[4530] Ensure that the form description editor will not crash with ne…
Browse files Browse the repository at this point in the history
…sted structure

Bug: #4530
Signed-off-by: Stéphane Bégaudeau <[email protected]>
  • Loading branch information
sbegaudeau authored and gcoutable committed Feb 13, 2025
1 parent d409dcb commit 55a45d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Now they are executed for some data if the data was coming from a studio too.
- https://github.com/eclipse-sirius/sirius-web/issues/4536[#4536] [sirius-web] Fix a recently introduced bug which broke semantic Undo/Redo support
- https://github.com/eclipse-sirius/sirius-web/issues/4498[#4498] [diagram] Fix an issue where the arrow heads were lost during SVG/PNG export.
- https://github.com/eclipse-sirius/sirius-web/issues/4545[#4545] [view] Ensure that widgets used to edit numbers are not created twice in view based forms
- https://github.com/eclipse-sirius/sirius-web/issues/4530[#4530] [formdescriptioneditor] Ensure that the frontend will not crash while trying to display some nested structure


=== New Features
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022, 2024 Obeo.
* Copyright (c) 2022, 2025 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -180,7 +180,7 @@ export const FlexboxContainerWidget = ({ page, widget }: FlexboxContainerWidgetP
return;
}

let index = widget.children.length || 0;
let index = widget.children?.length ?? 0;
if (isKind(id) || widgetContributions.find((widgetContribution) => widgetContribution.name === id)) {
const addWidgetInput: GQLAddWidgetInput = {
id: crypto.randomUUID(),
Expand All @@ -193,7 +193,7 @@ export const FlexboxContainerWidget = ({ page, widget }: FlexboxContainerWidgetP
const addWidgetVariables: GQLAddWidgetMutationVariables = { input: addWidgetInput };
addWidget({ variables: addWidgetVariables });
} else {
if (widget.children.find((w: GQLWidget) => w.id === id)) {
if (widget.children && widget.children.find((w: GQLWidget) => w.id === id)) {
index--;
}
const moveWidgetInput: GQLMoveWidgetInput = {
Expand All @@ -209,7 +209,7 @@ export const FlexboxContainerWidget = ({ page, widget }: FlexboxContainerWidgetP
}
};

let children = widget.children.map((childWidget: GQLWidget) => {
let children = (widget.children ?? []).map((childWidget: GQLWidget) => {
return (
<WidgetEntry
key={childWidget.id}
Expand Down

0 comments on commit 55a45d5

Please sign in to comment.