Copilot commented on code in PR #3303:
URL:
https://github.com/apache/incubator-kie-tools/pull/3303#discussion_r2412921792
##########
packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputHeaderCell.tsx:
##########
@@ -244,8 +244,12 @@ export function DecisionTableOutputHeaderCell(props: {
expressionPath={selectedObjectInfos?.expressionPath ?? []}
onChange={(newExpressionLanguage) =>
updater((dmnObject) => {
- dmnObject.defaultOutputEntry ??= { "@_id": generateUuid() };
- dmnObject.defaultOutputEntry["@_expressionLanguage"] =
newExpressionLanguage;
+ if (newExpressionLanguage === "") {
+ delete
dmnObject.defaultOutputEntry?.["@_expressionLanguage"];
Review Comment:
The optional chaining operator `?.` prevents the delete operation from
working correctly. If `defaultOutputEntry` is undefined, the delete operation
becomes a no-op, but if it exists, the property should be deleted. Use
`dmnObject.defaultOutputEntry && delete
dmnObject.defaultOutputEntry["@_expressionLanguage"]` instead.
```suggestion
dmnObject.defaultOutputEntry && delete
dmnObject.defaultOutputEntry["@_expressionLanguage"];
```
##########
packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableOutputHeaderCell.tsx:
##########
@@ -292,8 +296,12 @@ export function DecisionTableOutputHeaderCell(props: {
expressionPath={selectedObjectInfos?.expressionPath ?? []}
onChange={(newExpressionLanguage) =>
updater((dmnObject) => {
- dmnObject.outputValues ??= { "@_id": generateUuid(), text: {
__$$text: "" } };
- dmnObject.outputValues["@_expressionLanguage"] =
newExpressionLanguage;
+ if (newExpressionLanguage === "") {
+ delete dmnObject.outputValues?.["@_expressionLanguage"];
Review Comment:
The optional chaining operator `?.` prevents the delete operation from
working correctly. If `outputValues` is undefined, the delete operation becomes
a no-op, but if it exists, the property should be deleted. Use
`dmnObject.outputValues && delete
dmnObject.outputValues["@_expressionLanguage"]` instead.
```suggestion
dmnObject.outputValues && delete
dmnObject.outputValues["@_expressionLanguage"];
```
##########
packages/dmn-editor/src/propertiesPanel/BoxedExpressionPropertiesPanelComponents/DecisionTableInputHeaderCell.tsx:
##########
@@ -181,8 +185,12 @@ export function DecisionTableInputHeaderCell(props: {
expressionPath={selectedObjectInfos?.expressionPath ?? []}
onChange={(newExpressionLanguage) =>
updater((dmnObject) => {
- dmnObject.inputValues ??= { "@_id": generateUuid(), text: {
__$$text: "" } };
- dmnObject.inputValues["@_expressionLanguage"] =
newExpressionLanguage;
+ if (newExpressionLanguage === "") {
+ delete dmnObject.inputValues?.["@_expressionLanguage"];
Review Comment:
The optional chaining operator `?.` prevents the delete operation from
working correctly. If `inputValues` is undefined, the delete operation becomes
a no-op, but if it exists, the property should be deleted. Use
`dmnObject.inputValues && delete dmnObject.inputValues["@_expressionLanguage"]`
instead.
```suggestion
dmnObject.inputValues && delete
dmnObject.inputValues["@_expressionLanguage"];
```
--
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]