Fix ab Images extension throwing on frontend 1.53

LGraphNode.prototype now defines title/type as accessors. Object.assign
uses [[Set]], so assigning a plain object containing those keys onto
nodeType.prototype invoked the inherited setter with `this` bound to the
prototype, which has no _state, and threw a TypeError.

The throw aborted beforeRegisterNodeDef, so none of the node's methods
(onExecuted, onResize, getExtraMenuOptions, onDrawForeground,
onMouseMove, onNodeCreated) were ever installed.

title and type are set by ComfyUI's node registration anyway, so drop
them from the assigned object. The hardcoded title also shadowed the
localized display name.
This commit is contained in:
kk8bit
2026-09-20 17:31:03 +08:00
parent 894fdcca47
commit 58e978fc6f
+4 -2
View File
@@ -12,9 +12,11 @@ app.registerExtension({
async beforeRegisterNodeDef(nodeType, nodeData) {
if (nodeData.name !== "AB_Images") return;
// 不要把 title/type 放进这个对象:它会被 Object.assign 到 nodeType.prototype,
// 而 LGraphNode.prototype 上的 title/type 是 accessor,Object.assign 会触发继承的
// setter(此时 this 是 prototype,没有 _state),直接抛 TypeError。
// 两者本来也由 ComfyUI 的节点注册负责,这里设置无效。
const ABImagesNode = {
title: "AB Images",
type: "AB_Images",
imgs: [],
isPointerOver: false,
pointerPos: [0, 0],