This is an automated email from the ASF dual-hosted git repository.

xiaozhenliu pushed a commit to branch xiaozhen-fix-undoredo
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 2fb1a9e7d61f39701c4c7ad4118dfbd8dd786a08
Author: Xiao-zhen-Liu <[email protected]>
AuthorDate: Mon Oct 6 18:29:58 2025 -0700

    fix(gui): enable frontend undo-redo with bugfix for shared editing
---
 .../workflow-graph/model/shared-model-change-handler.ts    | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git 
a/core/gui/src/app/workspace/service/workflow-graph/model/shared-model-change-handler.ts
 
b/core/gui/src/app/workspace/service/workflow-graph/model/shared-model-change-handler.ts
index 4ad5bda5c8..00e5343412 100644
--- 
a/core/gui/src/app/workspace/service/workflow-graph/model/shared-model-change-handler.ts
+++ 
b/core/gui/src/app/workspace/service/workflow-graph/model/shared-model-change-handler.ts
@@ -153,9 +153,17 @@ 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.assertLinkIsValid(newLink);
+            const jointLinkCell = JointUIService.getJointLinkCell(newLink);
+            jointElementsToAdd.push(jointLinkCell);
+            linksToAdd.push(newLink);
+          } catch (error) {
+            // Invalid link
+            console.log("cannot add invalid link. cause: ", error);
+            this.texeraGraph.sharedModel.operatorLinkMap.delete(key);
+          }
         }
         if (change.action === "delete") {
           keysToDelete.push(key);

Reply via email to