[Refactor] Generate DOM widget id in constructor (#3508)

This commit is contained in:
Chenlei Hu
2025-04-18 13:47:16 -04:00
committed by GitHub
parent 5d584577fe
commit cd35f1d86d
4 changed files with 1 additions and 14 deletions

View File

@@ -103,7 +103,6 @@ abstract class BaseDOMWidgetImpl<V extends object | string>
readonly node: LGraphNode
constructor(obj: {
id: string
node: LGraphNode
name: string
type: string
@@ -114,7 +113,7 @@ abstract class BaseDOMWidgetImpl<V extends object | string>
this.name = obj.name
this.options = obj.options
this.id = obj.id
this.id = generateUUID()
this.node = obj.node
}
@@ -172,7 +171,6 @@ export class DOMWidgetImpl<T extends HTMLElement, V extends object | string>
readonly element: T
constructor(obj: {
id: string
node: LGraphNode
name: string
type: string
@@ -235,7 +233,6 @@ export class ComponentWidgetImpl<V extends object | string>
readonly inputSpec: InputSpec
constructor(obj: {
id: string
node: LGraphNode
name: string
component: Component
@@ -293,7 +290,6 @@ LGraphNode.prototype.addDOMWidget = function <
options: DOMWidgetOptions<V> = {}
): DOMWidget<T, V> {
const widget = new DOMWidgetImpl({
id: generateUUID(),
node: this,
name,
type,