Migrate ComfyUI extensions from deprecated monkey-patching to the context menu API: canvas and node menus, conditional items, submenus, and debugging tips.
This guide helps you migrate from the deprecated monkey-patching approach to the new context menu extension API.The old approach of monkey-patching LGraphCanvas.prototype.getCanvasMenuOptions and nodeType.prototype.getExtraMenuOptions is deprecated:
If you see deprecation warnings in your browser console, your extension is using the old API and should be migrated.
This declarative approach is cleaner and matches the patterns used throughout the ComfyUI codebase.
While a callback-based approach with has_submenu: true and new LiteGraph.ContextMenu() is also supported, the declarative submenu property is preferred for better maintainability.
[DEPRECATED] Monkey-patching getCanvasMenuOptions is deprecated. (Extension: "MyExtension")Please use the new context menu API instead.See: https://docs.comfy.org/custom-nodes/js/context-menu-migration
Your extension is using the old approach and should be migrated.