You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@texera.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2025/09/04 02:19:49 UTC
Re: [PR] fix(ui): Prevent link delete buttons from overlapping [texera]
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: dev-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org