jomarko commented on code in PR #2888:
URL:
https://github.com/apache/incubator-kie-tools/pull/2888#discussion_r1936812705
##########
packages/dmn-editor/src/mutations/updateExpressionWidths.ts:
##########
@@ -34,6 +34,6 @@ export function updateExpressionWidths({
widthsExtension["kie:ComponentWidths"] = [...widthsById.entries()].map(([k,
v]) => ({
"@_dmnElementRef": k,
- "kie:width": v.map((vv) => ({ __$$text: vv })),
+ "kie:width": v.filter((width) => width !== undefined).map((vv) => ({
__$$text: vv })),
Review Comment:
@Kusuma04-dev I think this is not proper place to do a fix. I agree the
issue is not reproducible with this changes, however I think similar approach
just hide a more serious bug in our code.
From the attached video, There we can see, that table has 6 columns (row
index, input, output, 3 annotations), while the xml has 7 `<kie:width>` tags.
This `+-1` is suspicious. I think the fix of the issue should be to prevent
generating 7 tags for 6 columns.
I would like to ask you to investigate more `DecisionTableExpression`
callbacks. This seems to do a lot with `+1` logic, maybe it is the root cause?
```
setWidthsById(({ newMap }) => {
const prev = newMap.get(id) ?? [];
const defaultWidth =
args.groupType === DecisionTableColumnType.InputClause
? DECISION_TABLE_INPUT_DEFAULT_WIDTH
: args.groupType === DecisionTableColumnType.OutputClause
? DECISION_TABLE_OUTPUT_DEFAULT_WIDTH
: DECISION_TABLE_ANNOTATION_DEFAULT_WIDTH;
const nextValues = [...prev];
const minValuesLength = args.beforeIndex + 1 + args.columnsCount;
nextValues.push(...Array(Math.max(0, minValuesLength -
nextValues.length)));
for (let i = 0; i < args.columnsCount; i++) {
const widthIndex = args.beforeIndex + i + 1; // + 1 to account for
the rowIndex column.
nextValues.splice(widthIndex, 0, defaultWidth);
}
newMap.set(id, nextValues);
});
```
Other callbacks that sounds as related are `onColumnAdded`,
`onColumnUpdates`, `setAnnotationColumnWidth` - all in
`DecisionTableExpression.tsx` . It is also interesting this issue is present
only for adding annotations columns.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]