fix(PreviewBridge): ComfyUI v1.34+ compatibility - widget.value non-configurable#1172
fix(PreviewBridge): ComfyUI v1.34+ compatibility - widget.value non-configurable#1172djdarcy wants to merge 2 commits into
Conversation
…onfigurable Breaking Change in ComfyUI v1.34+: - Vue frontend makes widget.value non-configurable - Object.defineProperty() fails silently (error swallowed) JavaScript Fix: - Replace Object.defineProperty(w, 'value') with node.onExecuted hook - Add null checks for widgets - Add configurable check for ImageReceiver Python Fix: - Add load_mask_from_clipspace() for direct disk loading - Clipspace paths now take priority over cache (user edits preserved) - Apply same fix to PreviewBridgeLatent All restore_mask modes tested: never, if_same_size, always
|
FYI ... while working on this fix, a few ideas came up that could possibly improve long-term maintainability:
I also developed some additional enhancements during debugging that weren't included in this minimal fix (content-based cache invalidation via These aren't blockers by any means, but could be valuable follow-up work. Happy to discuss or create separate issues if interested. The gist link provides the full code snippets for:
|
Detect when Python generates a new temp file (image changed) vs returning existing file (same image). Only update widget value when image actually changed, preserving clipspace paths that contain user-drawn masks. Fixes stale clipspace image loading after restart with different input.
|
Added 072a5e9 - fix for stale clipspace image after restart/image change The original fix had an issue: when a user drew a mask and then ran the workflow with a different input image, MaskEditor would still load the old clipspace image instead of the new one. This commit detects when Python generates a new temp file (indicating image changed) by checking Tested scenarios:
|
|
Following up on this PR - I've created an extended version of Preview Bridge as a standalone node: https://github.com/DazzleNodes/ComfyUI-PreviewBridgeExtended. It builds on the fixes here and adds:
The repo also has PBE_DEBUG=1 env var if you want to see the internals without digging through code. Feel free to borrow any ideas, incorporate changes into Impact Pack, or just know it exists as an alternative. Happy to discuss architecture decisions if useful. Happy new year! |
After ComfyUI updated to v1.34+ with the Vue-based frontend, the ImpactPack PreviewBridge node broke in two ways:
Debugging revealed a few causes...
ComfyUI v1.34+ made
widget.valuenon-configurable, causingObject.defineProperty()to fail silently (error swallowed by extension system).The original JavaScript code relied on intercepting
widget.valuechanges to:/impact/set/pb_id_imageWithout this registration,
PreviewBridge.load_image()couldn't find clipspace paths inpreview_bridge_image_id_map, returning empty 64x64 placeholder masks instead of actual user-drawn masks.Solution
JavaScript (
impact-image-util.js)Object.defineProperty(w, 'value', ...)withnode.onExecutedhookconfigurablecheck for ImageReceiver to prevent silent failuresPython (
bridge_nodes.py)load_mask_from_clipspace()to read masks directly from disk (bypasses broken registration)PreviewBridgeLatentDemo Video
Demonstrates:
blocksetting: "if_empty_mask" and "never" both workrestore_maskmodes: "never", "if_same_size", "always" all function correctlyTesting Summary
Backwards Compatibility
No breaking API changes. Existing workflows unaffected. Fix specifically targets ComfyUI v1.34+ frontend compatibility while maintaining support for older versions.
Related