5.1 KiB
ComfyUI Documentation Compliance Fixes
Overview
This document outlines the changes made to align the ComfyUI Queue Manager with the official ComfyUI custom node documentation and best practices.
Changes Made
1. Menu Integration - Official Topbar Menu API
Issue: The previous implementation used custom menu detection and multiple fallback methods that didn't follow the official ComfyUI topbar menu API.
Fix:
- Created
web/queue_manager_menu.jsfollowing the official API structure - Uses
app.registerExtension()with propercommandsandmenuCommandsarrays - Follows the exact pattern documented in the official ComfyUI documentation
Before:
// Custom menu detection with multiple fallback methods
const menuContainer = this.findMenuContainer();
if (menuContainer) {
this.createMenuButton(menuContainer);
}
After:
app.registerExtension({
name: "QueueManager",
commands: [
{
id: "queueManager.open",
label: "Open Queue Manager",
function: openQueueManager
}
],
menuCommands: [
{
path: ["Queue"],
commands: ["queueManager.open"]
}
]
});
2. Node Class Method Signatures
Issue: Used type hints and modern Python syntax that may not be compatible with all ComfyUI environments.
Fix:
- Removed type hints from class methods to match official examples
- Simplified method signatures to follow documented patterns
- Updated
VALIDATE_INPUTSto return error strings instead of boolean (following official docs)
Before:
@classmethod
def INPUT_TYPES(cls) -> dict[str, Any]: # noqa: N802
After:
@classmethod
def INPUT_TYPES(cls):
3. Web Directory Structure Simplification
Issue: Complex web extension registration with multiple files and custom routing.
Fix:
- Simplified to single extension file following official conventions
- Removed unnecessary
WEB_EXTENSIONSconfiguration - Streamlined
__init__.pyto export only required variables
Before:
WEB_EXTENSIONS = [
{"name": "queue_manager_extension", "path": "queue_manager_extension.js"}
]
After:
# Only export what's required by ComfyUI
__all__ = [
"NODE_CLASS_MAPPINGS",
"NODE_DISPLAY_NAME_MAPPINGS",
"WEB_DIRECTORY"
]
4. Extension File Consolidation
Issue: Multiple extension files (queue_manager_extension.js, menu_extension.js) with overlapping functionality.
Fix:
- Consolidated into single
queue_manager_menu.jsfile - Follows official extension structure with proper imports
- Uses standard ComfyUI extension hooks (
setup,beforeRegisterNodeDef)
5. Error Handling in VALIDATE_INPUTS
Issue: Returned boolean values from VALIDATE_INPUTS.
Fix:
- Updated to return error message strings as documented
- Follows official pattern: return
Truefor valid, error string for invalid
Before:
if not isinstance(priority, int) or priority < -10 or priority > 10:
return False
After:
if not isinstance(priority, int) or priority < -10 or priority > 10:
return "priority must be an integer between -10 and 10"
Files Modified
__init__.py- Simplified exports and removed complex extension registrationqueue_manager_node.py- Updated method signatures and validationweb/queue_manager_menu.js- New file following official APIweb/queue_manager_extension.js- Removed (replaced by menu file)web/menu_extension.js- Removed (consolidated into menu file)- Test files - Updated to reference new extension file
Compliance Verification
The changes ensure compliance with:
- Custom Node Overview
- Backend Server Properties
- JavaScript Extensions
- Topbar Menu API
- Getting Started Walkthrough
Testing
All existing tests have been updated to work with the new structure:
- Menu integration tests pass
- Extension file validation works
- Node registration follows official patterns
Benefits
- Better Compatibility: Follows official API patterns for maximum compatibility
- Simpler Maintenance: Single extension file instead of multiple overlapping files
- Future-Proof: Uses documented APIs that are less likely to break
- Standard Compliance: Matches patterns used by other ComfyUI extensions
- Cleaner Code: Removed complex fallback mechanisms in favor of standard approaches
Migration Notes
For users upgrading:
- The menu item will now appear under "Queue" in the top menu bar
- Keyboard shortcut (Ctrl+Shift+Q) remains the same
- All functionality is preserved, just using official APIs
- No changes needed to existing workflows or configurations