Copilot commented on code in PR #3602:
URL: https://github.com/apache/texera/pull/3602#discussion_r2320644630


##########
core/gui/src/app/workspace/service/joint-ui/joint-ui.service.ts:
##########
@@ -510,6 +510,42 @@ export class JointUIService {
     });
   }
 
+  public getRemoveButton(): new () => joint.linkTools.Button {
+    return joint.linkTools.Button.extend({

Review Comment:
   The method returns a constructor function (`new () => 
joint.linkTools.Button`) but creates it using `extend()`. Consider using a more 
explicit factory pattern or caching the extended class to avoid recreating it 
on every call.



##########
core/gui/src/app/workspace/component/workflow-editor/workflow-editor.component.ts:
##########
@@ -1086,18 +1086,17 @@ export class WorkflowEditorComponent implements 
AfterViewInit, OnDestroy {
     fromJointPaperEvent(this.paper, "link:mouseenter")
       .pipe(map(value => value[0]))
       .pipe(untilDestroyed(this))
-      .subscribe(elementView => {
+      .subscribe(linkView => {
+        // Create an array to hold the tools
+        const tools = [new (this.jointUIService.getRemoveButton())()];

Review Comment:
   The remove button constructor is created on every mouse enter event. 
Consider caching the constructor or the button instance to avoid unnecessary 
object creation on frequent mouse events.



-- 
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]

Reply via email to