Copilot commented on code in PR #3667:
URL: https://github.com/apache/texera/pull/3667#discussion_r2281084908
##########
core/gui/src/app/common/util/workflow-compilation-utils.ts:
##########
@@ -30,7 +31,7 @@ export function areAllPortSchemasEqual(schemas: (PortSchema |
undefined)[]): boo
if (schemas.length <= 1) {
return true;
}
- return schemas.every(schema => schema === schemas[0]);
+ return schemas.every(schema => isEqual(schemas[0], schema));
Review Comment:
The function doesn't handle `undefined` values properly. If `schemas[0]` is
undefined, `isEqual(undefined, schema)` will return true only when `schema` is
also undefined, but the function should handle mixed undefined/defined
scenarios consistently.
```suggestion
// If all schemas are undefined, return true
if (schemas.every(schema => schema === undefined)) {
return true;
}
// If some schemas are undefined and some are defined, return false
if (schemas.some(schema => schema === undefined) && schemas.some(schema =>
schema !== undefined)) {
return false;
}
// All schemas are defined, check if all are equal
const firstDefined = schemas.find(schema => schema !== undefined);
return schemas.every(schema => isEqual(firstDefined, schema));
```
--
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]