Skip to content

節點有看到,但是無法新增至桌布使用 #7

Description

@ioritree

问题描述

节点类名 ReservedVRAMSetterkomojini-comfyui-nodes 插件存在兼容性冲突,导致用户无法将该节点添加到画布。

根本原因

komojini_widgets.js 使用 nodeData.name.endsWith("Setter") 来识别其内部节点。由于我们的节点名为 ReservedVRAMSetter,会意外触发该分支逻辑,而该分支会去查找一个名为 "key" 的 widget,找不到便直接报错崩溃:

Uncaught TypeError: can't access property "value", (intermediate value)(...) is undefined
    onNodeCreated komojini_widgets.js:411

注:根本 bug 在于 komojini_widgets.js 的字符串匹配过于宽泛,此问题已单独向 komojini 作者反馈。

解决方案

将注册的节点类名从 ReservedVRAMSetter 改为任何不以 "Setter" 结尾的名称(例如 ReservedVRAMControl)即可解决冲突。UI 中显示的名称无需改变。

# nodes.py
class ReservedVRAMControl:   # 从 ReservedVRAMSetter 改名
    ...

NODE_CLASS_MAPPINGS = {
    "ReservedVRAMControl": ReservedVRAMControl
}
NODE_DISPLAY_NAME_MAPPINGS = {
    "ReservedVRAMControl": "Set Reserved VRAM(GB) ⚙️"  # 显示名称不变
}

已验证此修改可解决问题。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions