You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tiagobento (via GitHub)" <gi...@apache.org> on 2025/03/07 17:02:06 UTC

Re: [PR] kie-issues#2548: Cannot add a new record within an empty Decision Table [incubator-kie-tools]

tiagobento commented on code in PR #2912:
URL: https://github.com/apache/incubator-kie-tools/pull/2912#discussion_r1985405235


##########
packages/boxed-expression-component/src/expressions/ExpressionDefinitionRoot/ExpressionContainer.tsx:
##########
@@ -107,10 +108,18 @@ export const ExpressionContainer: React.FunctionComponent<ExpressionContainerPro
 
   const getPlacementRef = useCallback(() => containerRef.current!, []);
 
+  const newExpression =
+    expression?.__$$element === "decisionTable"
+      ? {
+          ...expression,
+          rule: expression?.rule?.length === 0 ? [createDefaultRule()] : expression?.rule,
+        }
+      : expression;

Review Comment:
   ExpressionContainer is a generic component. We need to solve this problem for Decision Tables exclusively. Adding an `if` here makes this behavior obscure and couples this component with Decision Tables in particular. Please re-iterate.



-- 
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