Skip to content

fix: Update compatibility with latest ComfyUI versions#5

Open
huchukato wants to merge 2 commits intoComfyAssets:mainfrom
huchukato:main
Open

fix: Update compatibility with latest ComfyUI versions#5
huchukato wants to merge 2 commits intoComfyAssets:mainfrom
huchukato:main

Conversation

@huchukato
Copy link

Summary

This PR updates ComfyUI-Selectors to be compatible with the latest ComfyUI versions, fixing JavaScript console errors that occurred after a year of no updates.

Issues Fixed

  • Import Path Updates: Fixed relative import paths for new ComfyUI structure
  • Deprecated API Methods: Replaced ctx.roundRect() with compatible Canvas API implementation
  • Code Duplication: Removed duplicate dimension_selectors.js causing conflicts
  • Event Handling: Optimized with MutationObserver and requestAnimationFrame
  • Resource Management: Improved cleanup and memory management

Changes Made

  • Updated all JavaScript import paths from ../../scripts/app.js to ../../../scripts/app.js
  • Replaced deprecated ctx.roundRect() with arcTo() implementation
  • Consolidated dimension selector files (removed duplicate)
  • Replaced setTimeout with requestAnimationFrame for better performance
  • Added MutationObserver for efficient value monitoring
  • Reduced polling frequency from 1s to 2s as fallback
  • Enhanced cleanup procedures for removed nodes

Testing

  • ✅ No JavaScript console errors on load
  • ✅ All nodes load correctly in comfyassets/ category
  • ✅ Sampler Selector works with all available samplers
  • ✅ Scheduler Selector shows all scheduler options
  • ✅ Seed History tracking and UI functions properly
  • ✅ Width/Height nodes with presets and swap functionality
  • ✅ Workflow save/load compatibility maintained

Compatibility

  • ComfyUI v0.3.0+
  • Node.js v18+
  • Modern browsers with ES6+ support

Breaking Changes

None - this is a compatibility fix only.

Additional

Added COMPATIBILITY_UPDATE.md with detailed documentation of all changes.

- Fix import paths for new ComfyUI structure
- Replace deprecated ctx.roundRect() with compatible implementation
- Remove duplicate dimension_selectors.js to prevent conflicts
- Optimize event handling with MutationObserver and requestAnimationFrame
- Improve cleanup and resource management
- Add compatibility documentation

Resolves JavaScript errors in newer ComfyUI versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant