Skip to content

Conversation

jtydhr88
Copy link
Collaborator

@jtydhr88 jtydhr88 commented Oct 7, 2025

Summary

fix mask editor issues on vueNodes

┆Issue is synchronized with this Notion page by Unito

@jtydhr88 jtydhr88 marked this pull request as draft October 7, 2025 02:06
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 7, 2025
Copy link

github-actions bot commented Oct 7, 2025

🎨 Storybook Build Status

Build completed successfully!

⏰ Completed at: 10/08/2025, 01:43:15 AM UTC

🔗 Links


🎉 Your Storybook is ready for review!

Copy link

github-actions bot commented Oct 7, 2025

🎭 Playwright Test Results

⚠️ Tests passed with flaky tests

⏰ Completed at: 10/08/2025, 01:53:22 AM UTC

📈 Summary

  • Total Tests: 489
  • Passed: 457 ✅
  • Failed: 0
  • Flaky: 2 ⚠️
  • Skipped: 30 ⏭️

📊 Test Reports by Browser

  • chromium: View Report • ✅ 448 / ❌ 0 / ⚠️ 2 / ⏭️ 30
  • chromium-2x: View Report • ✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • chromium-0.5x: View Report • ✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • mobile-chrome: View Report • ✅ 6 / ❌ 0 / ⚠️ 0 / ⏭️ 0

🎉 Click on the links above to view detailed test results for each browser configuration.

@comfyui-wiki
Copy link
Member

Yes this PR fixed the #5816

Screen.Recording.2025-10-07.at.18.06.18.mov

@christian-byrne christian-byrne added the claude-review Add to trigger a PR code review from Claude Code label Oct 8, 2025
if (node) {
node.imageIndex = currentIndex.value
node.imgs = await Promise.all(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[quality] medium Priority

Issue: Promise rejection not handled - Image loading could fail silently
Context: If an image fails to load in the Promise.all, the entire operation fails but there's no error handling
Suggestion: Add proper error handling with try-catch or Promise.allSettled to handle individual failures gracefully

if (node) {
node.imageIndex = currentIndex.value
node.imgs = await Promise.all(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[performance] medium Priority

Issue: Blocking image loading may freeze UI
Context: Promise.all waits for all images to load synchronously, potentially causing UI freezes with large images or slow networks
Suggestion: Consider loading images asynchronously or showing a loading indicator during this operation

if (props.nodeId) {
const node = app.rootGraph?.getNodeById(props.nodeId)
if (node) {
node.imageIndex = currentIndex.value
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[architecture] medium Priority

Issue: Direct mutation of node object properties
Context: Directly setting node.imageIndex and node.imgs bypasses Vue reactivity and violates immutability principles
Suggestion: Use a reactive store or emit events to parent components to handle state changes properly

if (ComfyApp.clipspace.imgs && node.imgs) {
if (node.images && ComfyApp.clipspace.images) {
// Update node.images even if it's initially undefined (vueNodes mode)
if (ComfyApp.clipspace.images) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[quality] high Priority

Issue: Logic condition removed may cause null reference errors
Context: Removed check for node.images existence before accessing ClipSpace.images could cause undefined/null references
Suggestion: Restore defensive check or add null safety: if (ComfyApp.clipspace.images && node.images)

app.graph.setDirtyCanvas(true)

if (node.images && app.nodeOutputs[node.id]) {
useNodeOutputStore().nodeOutputs[node.id] = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[quality] medium Priority

Issue: Potential race condition with nodeOutputs access
Context: Accessing app.nodeOutputs[node.id] and useNodeOutputStore().nodeOutputs[node.id] without proper synchronization could lead to race conditions
Suggestion: Add proper locks or use atomic operations when modifying shared state

Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comprehensive PR Review

This review is generated by Claude. It may not always be accurate, as with human reviewers. If you believe that any of the comments are invalid or incorrect, please state why for each. For others, please implement the changes in one way or another.

Review Summary

PR: fix mask editor bug under vueNodes (#5953)
Impact: 39 additions, 4 deletions across 2 files

Issue Distribution

  • Critical: 0
  • High: 1
  • Medium: 4
  • Low: 1

Category Breakdown

  • Architecture: 1 issue
  • Security: 1 issue
  • Performance: 1 issue
  • Code Quality: 3 issues

Key Findings

Architecture & Design

The PR introduces direct state mutations on node objects, which bypasses Vue's reactivity system. This pattern could lead to inconsistent state management. Consider using proper reactive stores or event-driven communication instead.

Security Considerations

The addition of crossOrigin = 'anonymous' enables cross-origin access to images. While likely necessary for canvas operations, ensure this doesn't expose sensitive images to unauthorized access.

Performance Impact

The synchronous Promise.all for image loading could block the UI thread, especially with large images or slow networks. Consider asynchronous loading patterns or loading indicators.

Integration Points

The changes improve vueNodes integration with the mask editor by properly setting up node state and synchronizing with the node output store. However, removed safety checks could introduce runtime errors.

Positive Observations

  • Good use of TypeScript with proper type annotations
  • Proper async/await pattern for the mask editor function
  • Icon updates follow the project's icon naming conventions (i-lucide:* format)
  • Added proper fallback logic for vueNodes mode

References

Next Steps

  1. Address the high-priority logic issue in app.ts to prevent potential null reference errors
  2. Consider architectural feedback for proper state management patterns
  3. Add error handling for image loading operations
  4. Consider performance optimizations for image loading
  5. Validate CORS security implications

This is a comprehensive automated review. For architectural decisions requiring human judgment, please request additional manual review.

@AustinMroz
Copy link
Collaborator

Accessing nodeOutputs by nodeId instead of nodeLocatorId will cause the code to break when run inside of subgraphs.

But from looking into it, it's a decent amount of work to cleanup the surrounding code to use locatorIds instead of assuming the node resides in the active graph which is kinda out of scope. I can handle it in a separate PR after this one is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
claude-review Add to trigger a PR code review from Claude Code size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vue node: MaskEditor is not loading the right image, and after editing the mask, the mask isn't saved correctly either.
5 participants