mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
fix: preserve lazily-created arrays during uninstrumentation cleanup
Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10496#discussion_r2990341198
This commit is contained in:
@@ -447,7 +447,23 @@ function restoreDescriptor(
|
||||
if (descriptor) {
|
||||
Object.defineProperty(node, prop, descriptor)
|
||||
} else {
|
||||
delete (node as unknown as Record<string, unknown>)[prop]
|
||||
// The property did not exist before instrumentation.
|
||||
// If it now holds a plain data value (e.g. an array populated while
|
||||
// instrumented), preserve it instead of deleting — otherwise lazily
|
||||
// created widgets/inputs/outputs arrays would be silently dropped.
|
||||
const live = Object.getOwnPropertyDescriptor(node, prop)
|
||||
if (live && !live.get && !live.set && live.value != null) {
|
||||
// Replace the reactive getter/setter with a plain data descriptor
|
||||
// so the value survives without Vue reactivity overhead.
|
||||
Object.defineProperty(node, prop, {
|
||||
value: live.value,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
})
|
||||
} else {
|
||||
delete (node as unknown as Record<string, unknown>)[prop]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user