CRITICAL FIX: Widget callback context error in MimicPC/web-based ComfyUI
BUG: TypeError: can't access property "step", this.options is undefined
- ROOT CAUSE: Width/height widget callbacks used .bind(this) to bind to node
- When calling originalWidthCallback.apply(this, arguments), passed NODE as context
- Original callback expected WIDGET as context (needs this.options.step)
- CRASH: Can't access this.options because node doesn't have options property
THE FIX (RegionalPrompting.js:362-393):
- REMOVED .bind(this) from widget callbacks
- Captured node reference in closure: const node = this
- Changed originalCallback.apply(this, arguments) to originalCallback.call(this, value)
- Now callback executes with WIDGET as context (default when not bound)
- Node properties accessed via closure: node.properties["width"]
WHY THIS MATTERS:
- MimicPC and browser-based ComfyUI instances couldn't load workflows at all
- Error occurred during workflow loading when configuring widgets
- Desktop ComfyUI might have different widget implementation (hence not caught earlier)
- This is a fundamental JavaScript context issue - widgets expect widget context
CREDITS UPDATE:
- Added GitHub link to Davemane42: https://github.com/Davemane42
- Maintains original author credit while making it easier to find their work
Documented complete technical details in CONTEXT.md.