You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "Kusuma04-dev (via GitHub)" <gi...@apache.org> on 2025/01/31 05:05:08 UTC

[PR] Kie-issues#1581 : New DMN Editor is getting crashed when working with Decision Table Annotation [incubator-kie-tools]

Kusuma04-dev opened a new pull request, #2888:
URL: https://github.com/apache/incubator-kie-tools/pull/2888

   closes https://github.com/apache/incubator-kie-issues/issues/1581 New DMN Editor is getting crashed when working with Decision Table Annotation


-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] Kie-issues#1581 : New DMN Editor is getting crashed when working with Decision Table Annotation [incubator-kie-tools]

Posted by "jomarko (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] Kie-issues#1581 : New DMN Editor is getting crashed when working with Decision Table Annotation [incubator-kie-tools]

Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev commented on code in PR #2888:
URL: https://github.com/apache/incubator-kie-tools/pull/2888#discussion_r1937231523


##########
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:
   Hi @jomarko ,Yes you are correct.Issue is adding extra count in the above code and i have changed now.Thanks for the review.



-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] kie-issues#1581: New DMN Editor is getting crashed when working with Decision Table Annotation [incubator-kie-tools]

Posted by "jomarko (via GitHub)" <gi...@apache.org>.
jomarko merged PR #2888:
URL: https://github.com/apache/incubator-kie-tools/pull/2888


-- 
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: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org