Line data Source code
1 : import type { IBaseWidget } from '@comfyorg/graph-model/widgets'
2 :
3 2355 : const widgetRenderKeys = new WeakMap<IBaseWidget, string>()
4 2355 : let nextWidgetRenderKeyId = 0
5 :
6 456 : export function getStableWidgetRenderKey(widget: IBaseWidget): string {
7 456 : const cachedKey = widgetRenderKeys.get(widget)
8 456 : if (cachedKey) return cachedKey
9 :
10 353 : const key = `widget:${nextWidgetRenderKeyId++}`
11 353 : widgetRenderKeys.set(widget, key)
12 353 : return key
13 : }
|