chenlica commented on code in PR #3836:
URL: https://github.com/apache/texera/pull/3836#discussion_r2415506214
##########
core/gui/src/app/workspace/service/workflow-graph/model/shared-model-change-handler.ts:
##########
@@ -153,9 +153,18 @@ export class SharedModelChangeHandler {
event.changes.keys.forEach((change, key) => {
if (change.action === "add") {
const newLink =
this.texeraGraph.sharedModel.operatorLinkMap.get(key) as OperatorLink;
- const jointLinkCell = JointUIService.getJointLinkCell(newLink);
- jointElementsToAdd.push(jointLinkCell);
- linksToAdd.push(newLink);
+ // Validate the link first
+ try {
+ this.texeraGraph.assertLinkNotDuplicated(newLink);
+ this.texeraGraph.assertLinkIsValid(newLink);
Review Comment:
To make the "repair" logic modularized, I suggest we create a function, and
move the "assert" operations in this function. Use a meaningful name with good
comments due to the subtlety of this step.
--
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]