Ma77Ball commented on code in PR #5676:
URL: https://github.com/apache/texera/pull/5676#discussion_r3607782257
##########
frontend/src/app/workspace/component/property-editor/operator-property-edit-frame/operator-property-edit-frame.component.ts:
##########
@@ -544,7 +544,11 @@ export class OperatorPropertyEditFrameComponent implements
OnInit, OnChanges, On
* @param event
*/
onFormChanges(event: Record<string, unknown>): void {
- this.sourceFormChangeEventStream.next(event);
+ const requiredFields = this.currentOperatorSchema?.jsonSchema?.required ??
[];
+ const cleanedEvent = Object.fromEntries(
+ Object.entries(event).filter(([key, value]) => value !== null ||
requiredFields.includes(key))
Review Comment:
Using `!== null` will only strip `null` values but not `undefined` values
(which can be produced by a cleared dropdown). I recommend using loose
inequality so both `null` and `undefined` are stripped for optional fields:
```suggestion
Object.entries(event).filter(([key, value]) => value != null ||
requiredFields.includes(key))
```
--
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]