Skip to content

feat: expose Vue node rendering controls - #14508

Closed
r-vage wants to merge 11 commits into
Comfy-Org:mainfrom
r-vage:feat/vue-node-render-control-api
Closed

r-vage wants to merge 11 commits into
Comfy-Org:mainfrom
r-vage:feat/vue-node-render-control-api

Conversation

@r-vage

@r-vage r-vage commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Expose a stable app.extensionManager.vueNodes.rendering API so extensions can coordinate Vue node render suppression without mutating graph state or depending on frontend internals.

Changes

  • What: Add immutable rendering snapshots, subscriptions, node render-state queries, and uniquely owned push and policy controllers.
  • Rendering behavior: Compose suppression and retention across owners, preserve frontend-required and uninitialized nodes, freeze unsafe suppression during interactions, and reset stale push contributions when the graph changes.
  • Lifecycle behavior: Render only the effective node list while preserving slot and link geometry across intentional DOM detach, movement, resize, remount, deletion, and graph cleanup.
  • Dependencies: None.

Review Focus

  • The public facade exposes only copied immutable state and controller methods, not Vue refs, Pinia stores, mutable sets, graph managers, or VueNodeData.
  • Retention wins over suppression across all owners. Policy failures fail open for that owner, and unknown or deleted IDs are ignored and pruned.
  • Focused, edited, input-capturing, selected-interaction, and link-interaction nodes remain rendered. New suppressions wait until drag and resize interactions finish.
  • Suppression changes only Vue rendering. Workflow graph contents, serialization, and cached link geometry remain intact.

Testing

  • pnpm test:unit src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts src/composables/graph/useGraphNodeManager.test.ts src/renderer/extensions/vueNodes/components/LGraphNode.test.ts (65 passed)
  • pnpm test:browser:local browser_tests/tests/vueNodes/renderingControlApi.spec.ts --project=chromium --workers=1 (1 passed)
  • pnpm typecheck
  • pnpm typecheck:browser
  • pnpm lint (0 errors; 59 pre-existing warnings)
  • pnpm format:check
  • pnpm knip

Screenshots (if applicable)

Not applicable. This change adds an extension API and rendering infrastructure with no visual UI changes.

@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: 🚧 Building...

🎭 Playwright: ⏳ Running...

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a Vue node rendering service with suppression, retention, lifecycle, snapshot, and policy APIs. Integrates runtime filtering into GraphCanvas. Preserves slot geometry during suppressed rendering and adds unit and browser coverage.

Changes

Vue node rendering service and public API

Layer / File(s) Summary
Rendering contracts and service
src/types/vueNodeRendering.ts, src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts
Adds render-state types, immutable snapshots, suppression and retention controllers, runtime synchronization, lifecycle tracking, and public service APIs.
Workspace exposure and validation
src/stores/workspaceStore.ts, src/types/extensionTypes.ts, src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts
Exposes the rendering API through workspace state and ExtensionManager. Tests cover controllers, policies, snapshots, lifecycle, frozen rendering, graph revisions, and pruning.

Runtime rendering integration

Layer / File(s) Summary
Runtime state synchronization
src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts, src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts
Collects required node IDs and canvas state. Updates the rendering service through watchers and animation frames. Returns filtered nodes and lifecycle handlers.
Canvas and node lifecycle wiring
src/components/graph/GraphCanvas.vue, src/renderer/extensions/vueNodes/components/LGraphNode.vue
Renders renderedNodes and forwards mount and unmount events carrying node IDs.
Browser validation
browser_tests/tests/vueNodes/renderingControlApi.spec.ts
Verifies suppression, retention, remount slot geometry, controller disposal, and graph structure stability.

Suppressed slot layout retention

Layer / File(s) Summary
Slot tracking and cleanup
src/renderer/extensions/vueNodes/stores/nodeSlotRegistryStore.ts, src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts, src/composables/graph/useGraphNodeManager.ts
Allows unmounted slot elements, retains suppressed-node geometry, updates cached positions, invalidates layouts after resizing, and clears layouts during node removal or manager cleanup.
Slot tracking validation
src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts, src/composables/graph/useGraphNodeManager.test.ts
Tests retained geometry, position translation, resize invalidation, explicit deletion, suppressed unmounting, remount measurement, collapsed-node offsets, and node cleanup.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Suggested labels: refactor

Suggested reviewers: jaeone94


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
End-To-End Regression Coverage For Fixes ❓ Inconclusive The changed-file list and description are available, but the PR title and commit subjects are not provided, so the required bug-fix signal cannot be verified. Provide the PR title and commit subjects to determine whether the end-to-end regression coverage check applies.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: exposing Vue node rendering controls.
Description check ✅ Passed The description covers the summary, changes, review focus, testing, dependencies, and screenshot status with relevant implementation details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Adr Compliance For Entity/Litegraph Changes ✅ Passed The PR changes node and slot files, so the check applies. The provided diff metadata shows no direct entity mutations, god-object methods, ECS component methods, or listed extension callback changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts`:
- Around line 261-270: In updateNodeSlotsFromCache, guard the
scheduleSlotLayoutSync(nodeId) call in the !entry.cachedOffset branch with
isVueNodeRenderSuppressed(nodeId), matching the existing guard in
subscribeToNodeLayoutChanges. Continue deleting the slot layout, but do not
schedule DOM synchronization for suppressed nodes.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts`:
- Around line 196-198: Update the runtime tracking around useRafFn and
frameStateChanged to avoid unconditional per-frame work: run the tracker only
while the canvas is dirty or an interaction is active, and compare the
inexpensive numeric frame-state fields before invoking focusedNodeId(). Preserve
refreshRuntime() when a meaningful frame-state change is detected, while
avoiding getFrameState’s DOM query and array allocation during idle frames.

In `@src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts`:
- Around line 133-165: Coalesce lifecycle-triggered recompute calls from
nodeMounted into one microtask or animation-frame flush instead of executing
once per mounted node. Update recompute/notification scheduling so multiple
events share a pending flush and createSnapshot runs only once for the batch,
while preserving the latest state and existing notification behavior.
- Around line 44-47: Replace the shared EMPTY_CONTRIBUTION constant with an
emptyContribution() factory that returns a fresh object containing new suppress
and retain Sets on every call. Update all reset sites currently assigning
EMPTY_CONTRIBUTION to invoke emptyContribution(), including the paths around the
identified reset locations, while preserving the existing empty contribution
shape.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: db67b094-be1b-4d5c-862d-261e882a24ed

📥 Commits

Reviewing files that changed from the base of the PR and between 9cb5610 and cbf3e3a.

📒 Files selected for processing (14)
  • browser_tests/tests/vueNodes/renderingControlApi.spec.ts
  • src/components/graph/GraphCanvas.vue
  • src/composables/graph/useGraphNodeManager.test.ts
  • src/composables/graph/useGraphNodeManager.ts
  • src/renderer/extensions/vueNodes/components/LGraphNode.vue
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts
  • src/renderer/extensions/vueNodes/stores/nodeSlotRegistryStore.ts
  • src/stores/workspaceStore.ts
  • src/types/extensionTypes.ts
  • src/types/vueNodeRendering.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts (1)

335-338: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Coalesce nodeUnmounted the same way as nodeMounted.

nodeUnmounted still calls recompute() synchronously for every call. nodeMounted now defers to scheduleMountRecompute() specifically to avoid one full pruneState/createSnapshot/notify cycle per node during bursts. Node unmounts happen in bursts too: bulk deletion, undo of multi-node operations, and virtualization churn as nodes scroll out of view all fire multiple nodeUnmounted calls in the same tick. Each call still pays the same O(n) pruneState/createSnapshot cost that the mount-side fix was designed to avoid.

Reuse the same scheduling mechanism for both lifecycle events.

♻️ Proposed fix
-  let mountRecomputeScheduled = false
+  let recomputeScheduled = false
@@
-  function scheduleMountRecompute(): void {
-    if (mountRecomputeScheduled) return
-    mountRecomputeScheduled = true
+  function scheduleRecompute(): void {
+    if (recomputeScheduled) return
+    recomputeScheduled = true
     queueMicrotask(() => {
-      if (!mountRecomputeScheduled) return
+      if (!recomputeScheduled) return
       recompute()
     })
   }
@@
   function recompute(): void {
-    mountRecomputeScheduled = false
+    recomputeScheduled = false
     pruneState()
@@
   function nodeMounted(id: string): void {
     if (!knownNodeIds().has(id)) return
     const changed = !mountedNodeIds.has(id) || !initializedNodeIds.has(id)
     mountedNodeIds.add(id)
     initializedNodeIds.add(id)
-    if (changed) scheduleMountRecompute()
+    if (changed) scheduleRecompute()
   }
 
   function nodeUnmounted(id: string): void {
     if (!mountedNodeIds.delete(id)) return
-    recompute()
+    scheduleRecompute()
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts` around
lines 335 - 338, Update nodeUnmounted to use the same deferred recomputation
mechanism as nodeMounted: after successfully deleting the ID from
mountedNodeIds, call scheduleMountRecompute() instead of recompute(). Preserve
the early return for IDs that were not mounted and reuse the existing scheduler.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts`:
- Around line 335-338: Update nodeUnmounted to use the same deferred
recomputation mechanism as nodeMounted: after successfully deleting the ID from
mountedNodeIds, call scheduleMountRecompute() instead of recompute(). Preserve
the early return for IDs that were not mounted and reuse the existing scheduler.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ef41b1d9-cd8d-41a3-99c4-33ef223e4b8e

📥 Commits

Reviewing files that changed from the base of the PR and between cbf3e3a and 11f6d19.

📒 Files selected for processing (6)
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 31, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts`:
- Around line 221-224: Update the subscription test around the listener callback
and service snapshot so it asserts the snapshot payload received by listener
contains mountedNodeIds equal to ['3']; retain the existing call-count and
timing assertions, but do not rely solely on service.getSnapshot() after the
microtask.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3308ee10-330b-4a6a-93c7-2cb55ed47deb

📥 Commits

Reviewing files that changed from the base of the PR and between 11f6d19 and 98bd4d7.

📒 Files selected for processing (2)
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 31, 2026
@r-vage
r-vage force-pushed the feat/vue-node-render-control-api branch from c672d3b to 21ba26f Compare August 1, 2026 03:13
@r-vage
r-vage changed the base branch from main to drjkl/node-geometry-facade August 1, 2026 03:14
@r-vage

r-vage commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@browser_tests/tests/vueNodes/renderingControlApi.spec.ts`:
- Around line 96-104: Wrap the remounted slot geometry read and x/y comparisons
in a Playwright retrying assertion, such as an expect.poll-style callback, so
layout synchronization can complete before validation. Keep the existing
visibility wait and targetSlot reference, but perform boundingBox() inside the
retry and preserve the unavailable-geometry failure behavior.

In `@src/components/graph/GraphCanvas.vue`:
- Around line 327-330: Gate useVueNodeRendering behind shouldRenderVueNodes so
runtime tracking and synchronization do not run in legacy canvas mode. Extend
useVueNodeRendering with an enabled MaybeRefOrGetter option, pass
shouldRenderVueNodes from GraphCanvas.vue, and return early from both its
useRafFn callback and refreshRuntime when disabled.

In `@src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts`:
- Around line 182-185: Update the mismatched-node cleanup branch in the slot
tracking logic to remove the stale slot entry from node.slots in addition to
calling layoutStore.deleteSlotLayout(slotKey). Keep this cleanup consistent with
the disconnected-element branch so reparented or unresolved entries are pruned
from the registry.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts`:
- Around line 138-162: Extend the tests around useVueNodeRendering to cover
lifecycle and filtering behavior: after scope.stop(), assert
renderingService.unsubscribe is called and renderingService.updateRuntime
receives an empty graph; verify renderedNodes contains only allNodes whose IDs
appear in snapshot.renderedNodeIds; and verify onNodeMounted and onNodeUnmounted
forward stringified node IDs to the corresponding renderingService methods.
- Around line 24-28: Update the layoutState factory in
useVueNodeRendering.test.ts to create isDraggingVueNodes, isResizingVueNodes,
and version with real Vue ref instances obtained inside vi.hoisted, replacing
the manually constructed __v_isRef/value objects while preserving their initial
values.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts`:
- Around line 135-176: Refactor getFrameState to return a named viewport object
containing scale, offset coordinates, canvas dimensions, and a separate
variable-length rest array for the remaining state. Update frameStateChanged to
compare viewport fields by name and compare only the rest array positionally,
removing all reliance on lastFrameState[0] through lastFrameState[4] while
preserving change detection behavior.

In `@src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts`:
- Around line 154-177: Update the test callback for “publishes copied, deeply
frozen snapshots and supports unsubscribe” to be async, await one microtask
after service.nodeMounted('1'), then assert listener was still called only
twice. This must exercise the scheduled notification path through
scheduleMountRecompute so the unsubscribe behavior is validated after pending
reactivity runs.

In `@src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts`:
- Around line 392-424: Cache the known-node ID set in the rendering service
state instead of rebuilding it in each query. Update the cached set immediately
after assigning nextNodes to nodes in updateRuntime, then change knownNodeIds
and the getNodeRenderState/isVueNodeRenderSuppressed query paths to read that
cached state while preserving existing node-ID normalization and render-state
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2ff8904b-0bc7-4e49-9055-6b73649f7f5e

📥 Commits

Reviewing files that changed from the base of the PR and between d52bd10 and 21ba26f.

📒 Files selected for processing (13)
  • browser_tests/tests/vueNodes/renderingControlApi.spec.ts
  • src/components/graph/GraphCanvas.vue
  • src/renderer/extensions/vueNodes/components/LGraphNode.vue
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts
  • src/renderer/extensions/vueNodes/stores/nodeSlotRegistryStore.ts
  • src/stores/workspaceStore.ts
  • src/types/extensionTypes.ts
  • src/types/vueNodeRendering.ts

Comment thread src/components/graph/GraphCanvas.vue Resolved
@r-vage
r-vage force-pushed the feat/vue-node-render-control-api branch from 21ba26f to c672d3b Compare August 1, 2026 11:33
@r-vage
r-vage changed the base branch from drjkl/node-geometry-facade to main August 1, 2026 11:34
@r-vage

r-vage commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 16 minutes.

@r-vage

r-vage commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai rate limt

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@r-vage The full review reached the included review limit.

Retry after the indicated wait period. The previous response reported 16 minutes. Usage-based billing can also allow the review to proceed when eligible.

🐇

You are interacting with an AI system.

@r-vage

r-vage commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

♻️ Duplicate comments (6)
src/components/graph/GraphCanvas.vue (1)

299-303: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Gate the rendering runtime on shouldRenderVueNodes.

useVueNodeRendering runs unconditionally. Its useRafFn tracker and its flush: 'sync' watcher therefore stay active for the whole session, including when shouldRenderVueNodes is false and the legacy canvas renderer draws the graph. shouldTrackRuntime returns true whenever dirty_canvas or dirty_bgcanvas is set, which is the normal state during legacy canvas interaction. In legacy mode nothing consumes renderedNodes, so the work produces no output.

♻️ Suggested approach

Accept an enabled: MaybeRefOrGetter<boolean> option in useVueNodeRendering, then return early from the useRafFn callback and from refreshRuntime when it is false.

 const { onNodeMounted, onNodeUnmounted, renderedNodes } = useVueNodeRendering({
   allNodes,
   canvas: () => canvasStore.canvas,
-  nodeManager: () => vueNodeLifecycle.nodeManager.value
+  nodeManager: () => vueNodeLifecycle.nodeManager.value,
+  enabled: shouldRenderVueNodes
 })
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/graph/GraphCanvas.vue` around lines 299 - 303, Gate
useVueNodeRendering behind shouldRenderVueNodes by adding an enabled
MaybeRefOrGetter option and passing the existing flag from GraphCanvas. In the
composable, check enabled in both the useRafFn callback and refreshRuntime,
returning without tracking or flushing when disabled; preserve current behavior
when enabled.
src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts (1)

140-181: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the positional index contract between getFrameState and frameStateChanged.

frameStateChanged reads lastFrameState[0] through lastFrameState[4] and assumes those slots hold scale, offset x, offset y, canvas width, and canvas height. getFrameState defines that order implicitly. If a future change inserts an entry at the front of getFrameState, the fast path compares the wrong fields and the tracker stops detecting pan and zoom. No test guards the alignment.

Return a named viewport object for the cheap fields and keep only the variable-length tail as an array, then compare the viewport fields by name.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts` around
lines 140 - 181, Update getFrameState to return named viewport fields for scale,
offset coordinates, canvas dimensions, and the existing variable-length state
tail separately, rather than relying on positional indexes. Update
frameStateChanged to compare those viewport fields by name while preserving the
existing tail comparison and change-detection behavior.
browser_tests/tests/vueNodes/renderingControlApi.spec.ts (1)

99-104: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Retry the slot geometry comparison to prevent flake.

Line 96 waits for the node element to be visible. It does not wait for the slot connection dot to be measured and positioned. Slot layout is restored through a layout sync pass after remount, so boundingBox() at Line 99 can read a position from before that pass completes. boundingBox() is a one-shot read, and toBeCloseTo does not retry.

♻️ Proposed fix
-      const remountedSlotBox = await targetSlot.boundingBox()
-      if (!remountedSlotBox) {
-        throw new Error('Remounted target slot geometry unavailable')
-      }
-      expect(remountedSlotBox.x).toBeCloseTo(initialSlotBox.x, 0)
-      expect(remountedSlotBox.y).toBeCloseTo(initialSlotBox.y, 0)
+      await expect(async () => {
+        const remountedSlotBox = await targetSlot.boundingBox()
+        if (!remountedSlotBox) {
+          throw new Error('Remounted target slot geometry unavailable')
+        }
+        expect(remountedSlotBox.x).toBeCloseTo(initialSlotBox.x, 0)
+        expect(remountedSlotBox.y).toBeCloseTo(initialSlotBox.y, 0)
+      }).toPass()

As per coding guidelines, Playwright tests must prefer locator actions and retrying assertions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@browser_tests/tests/vueNodes/renderingControlApi.spec.ts` around lines 99 -
104, Update the remounted slot geometry checks around remountedSlotBox to use
Playwright’s retrying locator assertion rather than a one-shot boundingBox read,
waiting until the slot connection dot’s x and y coordinates match initialSlotBox
after layout synchronization. Preserve the existing geometry tolerance and
failure behavior while ensuring the assertion targets the slot locator that
becomes positioned after remount.

Source: Coding guidelines

src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts (2)

26-30: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Create real Vue refs in the mocked layout store.

layoutState hand-builds { __v_isRef: true, value: ... }. __v_isRef is an internal Vue marker, so toValue, watch, and layoutStore.getVersion() depend on an implementation detail. Create the refs inside the vi.hoisted factory instead.

♻️ Proposed fix
 const layoutState = vi.hoisted(() => {
-  isDraggingVueNodes: { __v_isRef: true, value: false },
-  isResizingVueNodes: { __v_isRef: true, value: false },
-  version: { __v_isRef: true, value: 0 }
-})
+  const { ref } = require('vue')
+  return {
+    isDraggingVueNodes: ref(false),
+    isResizingVueNodes: ref(false),
+    version: ref(0)
+  }
+})

Based on learnings, vi.hoisted factories run before static ESM imports initialize, so load Vue with require('vue') inside the factory.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts`
around lines 26 - 30, Update the layoutState factory used by the mocked layout
store to create isDraggingVueNodes, isResizingVueNodes, and version with real
Vue refs rather than manually setting __v_isRef. Load Vue via require('vue')
inside the vi.hoisted factory, then initialize each ref with its existing value
so toValue, watch, and layoutStore.getVersion() use authentic ref behavior.

Source: Learnings


148-180: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for scope disposal and rendered-node filtering.

This file tests only the idle-frame optimization. Three observable behaviors of the composable remain untested:

  • onScopeDispose must call unsubscribe and must reset the service runtime to an empty graph.
  • renderedNodes must filter allNodes down to snapshot.renderedNodeIds.
  • onNodeMounted and onNodeUnmounted must forward stringified IDs to the service.

The renderingService.unsubscribe and renderingService.updateRuntime spies already exist, so the disposal test needs only scope.stop() plus assertions. To assert the forwarding, move nodeMounted and nodeUnmounted into the hoisted renderingService object so the test can reference them.

Do you want me to generate these tests?

As per path instructions, .agents/checks/test-quality.md requires coverage of controller ownership and disposal and of lifecycle cleanup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts`
around lines 148 - 180, Expand the tests around useVueNodeRendering to cover
disposal, rendered-node filtering, and lifecycle forwarding. Add nodeMounted and
nodeUnmounted spies to the hoisted renderingService mock, verify
onNodeMounted/onNodeUnmounted pass stringified IDs, and assert renderedNodes
contains only IDs listed by snapshot.renderedNodeIds. Stop the effect scope and
verify unsubscribe is called and updateRuntime resets the service to an empty
graph.

Source: Path instructions

src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts (1)

154-177: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

The unsubscribe assertion cannot fail.

nodeMounted defers notification through scheduleMountRecompute, which uses queueMicrotask. Line 176 runs in the same tick, so no notification has been delivered yet. A broken unsubscribe() would still pass.

Await one microtask before the final assertion, and make the test callback async.

💚 Proposed fix
-  it('publishes copied, deeply frozen snapshots and supports unsubscribe', () => {
+  it('publishes copied, deeply frozen snapshots and supports unsubscribe', async () => {
     unsubscribe()
     service.nodeMounted('1')
+    await Promise.resolve()
     expect(listener).toHaveBeenCalledTimes(2)

As per path instructions, docs/guidance/vitest.md requires awaiting reactivity before asserting.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts`
around lines 154 - 177, Make the test callback for “publishes copied, deeply
frozen snapshots and supports unsubscribe” async, then await one microtask after
service.nodeMounted('1') before asserting the listener call count. This must
allow scheduleMountRecompute’s queued notification to run so the unsubscribe
behavior is actually verified.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts`:
- Around line 132-146: Guard the cleanup in afterEach so scope.stop() is called
only when scope was successfully assigned by the test. Update the scope handling
around the existing beforeEach/afterEach setup without changing normal cleanup
behavior.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts`:
- Around line 105-138: Update refreshRuntime so it does not rebuild the nodes
render-area mapping while renderFrozen is true during dragging or resizing;
continue passing the frozen state and frontendRequiredNodeIds, while preserving
the existing node mapping for unfrozen updates.
- Around line 215-231: Update the node-ID source in the watch call so it returns
a stable scalar, such as the joined node IDs, instead of allocating a new array
on every evaluation. Preserve refreshes when node identity or ordering changes,
while preventing the sync watcher from treating every invalidation as a change;
leave refreshRuntime and the other watch sources unchanged.

In `@src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts`:
- Around line 128-130: Cache known node IDs in service state instead of
rebuilding them in knownNodeIds(). Add or reuse a nodeIdSet state value, refresh
it immediately after nodes = nextNodes in updateRuntime, and have knownNodeIds()
return the cached set so getNodeRenderState and isVueNodeRenderSuppressed avoid
repeated O(N) allocation.
- Around line 255-262: Update recompute to call createSnapshot only when owners
contains at least one policy owner, using a hasPolicyOwner() helper that scans
owners.values() for kind === 'policy'; otherwise skip the pre-policy snapshot
while preserving the existing policy evaluation and notification flow.

---

Duplicate comments:
In `@browser_tests/tests/vueNodes/renderingControlApi.spec.ts`:
- Around line 99-104: Update the remounted slot geometry checks around
remountedSlotBox to use Playwright’s retrying locator assertion rather than a
one-shot boundingBox read, waiting until the slot connection dot’s x and y
coordinates match initialSlotBox after layout synchronization. Preserve the
existing geometry tolerance and failure behavior while ensuring the assertion
targets the slot locator that becomes positioned after remount.

In `@src/components/graph/GraphCanvas.vue`:
- Around line 299-303: Gate useVueNodeRendering behind shouldRenderVueNodes by
adding an enabled MaybeRefOrGetter option and passing the existing flag from
GraphCanvas. In the composable, check enabled in both the useRafFn callback and
refreshRuntime, returning without tracking or flushing when disabled; preserve
current behavior when enabled.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts`:
- Around line 26-30: Update the layoutState factory used by the mocked layout
store to create isDraggingVueNodes, isResizingVueNodes, and version with real
Vue refs rather than manually setting __v_isRef. Load Vue via require('vue')
inside the vi.hoisted factory, then initialize each ref with its existing value
so toValue, watch, and layoutStore.getVersion() use authentic ref behavior.
- Around line 148-180: Expand the tests around useVueNodeRendering to cover
disposal, rendered-node filtering, and lifecycle forwarding. Add nodeMounted and
nodeUnmounted spies to the hoisted renderingService mock, verify
onNodeMounted/onNodeUnmounted pass stringified IDs, and assert renderedNodes
contains only IDs listed by snapshot.renderedNodeIds. Stop the effect scope and
verify unsubscribe is called and updateRuntime resets the service to an empty
graph.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts`:
- Around line 140-181: Update getFrameState to return named viewport fields for
scale, offset coordinates, canvas dimensions, and the existing variable-length
state tail separately, rather than relying on positional indexes. Update
frameStateChanged to compare those viewport fields by name while preserving the
existing tail comparison and change-detection behavior.

In `@src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts`:
- Around line 154-177: Make the test callback for “publishes copied, deeply
frozen snapshots and supports unsubscribe” async, then await one microtask after
service.nodeMounted('1') before asserting the listener call count. This must
allow scheduleMountRecompute’s queued notification to run so the unsubscribe
behavior is actually verified.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1957fb11-1966-44f3-bc53-3e355a518c8e

📥 Commits

Reviewing files that changed from the base of the PR and between dfefba0 and 886027d.

📒 Files selected for processing (15)
  • browser_tests/tests/vueNodes/renderingControlApi.spec.ts
  • src/components/graph/GraphCanvas.vue
  • src/composables/graph/useGraphNodeManager.test.ts
  • src/composables/graph/useGraphNodeManager.ts
  • src/renderer/extensions/vueNodes/components/LGraphNode.vue
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts
  • src/renderer/extensions/vueNodes/stores/nodeSlotRegistryStore.ts
  • src/stores/workspaceStore.ts
  • src/types/extensionTypes.ts
  • src/types/vueNodeRendering.ts

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 1, 2026
@r-vage
r-vage marked this pull request as ready for review August 1, 2026 15:19
@r-vage
r-vage requested a review from a team August 1, 2026 15:19
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Aug 1, 2026
@dosubot

dosubot Bot commented Aug 1, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-09-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about ComfyUI_frontend Add Dosu to your team

@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Aug 2, 2026
@r-vage

r-vage commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@browser_tests/tests/vueNodes/renderingControlApi.spec.ts`:
- Around line 57-62: Update the baseline geometry setup around targetSlot and
initialSlotBox to wait for the target connection dot to become visible using the
browser test’s retrying assertion pattern before calling boundingBox(). Preserve
the existing missing-geometry error handling and use the established
visibility-wait helper or assertion from the test framework.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts`:
- Line 31: Extend the rendering test around nodeOptions and the RAF callback to
cover the open-node tail-change path: set nodeOptions.open = true and
canvas.dirty_canvas = true, invoke raf.callback?.(), then assert updateRuntime
was called and updateViewport was not. Ensure the test exercises the behavioral
branch in getFrameStateChange rather than only configuring mocks.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts`:
- Around line 311-322: Protect the onScopeDispose runtime reset in
useVueNodeRendering with module-level ownership tracking via an activeInstance
variable. Assign the current composable instance as active and only perform the
pause, unsubscribe, and vueNodeRenderingService.updateRuntime reset when the
disposing instance still owns that active slot; ensure newer instances are not
cleared by older teardown.

In `@src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts`:
- Around line 12-42: The test suite lacks coverage for the empty-graph teardown
state produced by runtime(null). Add a test using the real useVueNodeRendering
service that first applies a populated runtime, registers a push controller,
then applies runtime(null); assert nodeIds, renderedNodeIds, and mountedNodeIds
are empty and getNodeRenderState('1') returns 'unknown'.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6516a4f1-1d1f-455a-bd1e-e9b83cc53aa1

📥 Commits

Reviewing files that changed from the base of the PR and between 6f86ace and 5926e23.

📒 Files selected for processing (15)
  • browser_tests/tests/vueNodes/renderingControlApi.spec.ts
  • src/components/graph/GraphCanvas.vue
  • src/composables/graph/useGraphNodeManager.test.ts
  • src/composables/graph/useGraphNodeManager.ts
  • src/renderer/extensions/vueNodes/components/LGraphNode.vue
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeRendering.test.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeRendering.ts
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.test.ts
  • src/renderer/extensions/vueNodes/services/vueNodeRenderingService.ts
  • src/renderer/extensions/vueNodes/stores/nodeSlotRegistryStore.ts
  • src/stores/workspaceStore.ts
  • src/types/extensionTypes.ts
  • src/types/vueNodeRendering.ts

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 2, 2026
@r-vage
r-vage marked this pull request as draft August 2, 2026 16:19
@r-vage r-vage closed this Aug 2, 2026
@r-vage
r-vage deleted the feat/vue-node-render-control-api branch August 2, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant