Skip to content

Feat/vue node viewport virtualization - #14259

Closed
r-vage wants to merge 18 commits into
Comfy-Org:mainfrom
r-vage:feat/vue-node-viewport-virtualization
Closed

r-vage wants to merge 18 commits into
Comfy-Org:mainfrom
r-vage:feat/vue-node-viewport-virtualization

Conversation

@r-vage

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

Copy link
Copy Markdown
Contributor

Summary

Reduce large-workflow DOM cost by rendering Vue nodes in the settled viewport
while preserving layout, workflow execution, serialization, and active
interactions.

Changes

  • What: Hydrate every node once to establish layout, then mount only nodes
    intersecting the settled viewport when the experimental setting is enabled.
  • What: Keep selected, focused, edited, dragged, resized, and link-drag nodes
    mounted; freeze the mount set during active transforms to avoid interrupting
    pointer ownership.
  • What: Add an optional low-zoom level of detail that hides expensive node
    details while retaining shells, titles, sockets, links, and layout.
  • What: Keep cached socket geometry subscribed to node-scoped layout changes
    across viewport unmounts, translate it during node and group movement, and
    remeasure it when canonical node dimensions change.
  • What: Add experimental settings for viewport virtualization, low-zoom
    detail, and the full-detail zoom threshold.
  • Dependencies: Built on fix/vue-node-expanded-size so remounted collapsed
    nodes retain their canonical expanded dimensions.

Review Focus

  • Hydration and viewport-settle timing, especially after graph replacement and
    rapid pan or zoom changes.
  • Protected-node behavior during focus, menus, title editing, drag/resize, and
    link creation.
  • Slot tracking cleanup and restoration when nodes repeatedly unmount and
    remount, including collapsed nodes and group movement.
  • Low-detail remounts must change detail visibility without changing canonical
    expanded node dimensions.

Testing

  • pnpm typecheck
  • pnpm typecheck:browser
  • Focused viewport, low-zoom LOD, and slot-tracking Vitest coverage: 41 tests
    passed
  • Targeted Playwright hydration, remount, and drag-freeze coverage: 3 tests
    passed
  • New collapsed-node and group link-tracking Playwright coverage: 2 tests
    passed
  • Remount lifecycle and low-detail size-invariant Playwright coverage passed on
    the 1.45 backport and 1.49 combined lineages
  • E2E regression coverage:
    browser_tests/tests/vueNodes/viewportVirtualization.spec.ts
  • Collapsed-size remount coverage:
    browser_tests/tests/vueNodes/interactions/node/resize.spec.ts
  • Link-tracking E2E regression coverage:
    browser_tests/tests/vueNodes/interactions/node/move.spec.ts
  • Focused ESLint and oxfmt checks passed
  • Independent 1.45 and 1.49 production builds passed
  • git diff --check

Screenshots

vokoscreenNG-2026-08-03_17-14-06.webm

@r-vage
r-vage requested a review from a team July 29, 2026 10:49
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Jul 29, 2026
@dosubot

dosubot Bot commented Jul 29, 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

@r-vage
r-vage marked this pull request as draft July 29, 2026 10:49
@github-actions

github-actions Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: 🚧 Building...

🎭 Playwright: ⏳ Running...

@coderabbitai

coderabbitai Bot commented Jul 29, 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

Vue node rendering now supports viewport virtualization and zoom-based low-detail mode. Slot geometry remains tracked across virtualization and movement. Collapsed nodes preserve expanded dimensions through visual-only bounds updates. Widget serialization and restoration now handle compact values and named-property safety.

Changes

Vue node virtualization and low-detail rendering

Layer / File(s) Summary
Viewport virtualization and LOD pipeline
src/components/graph/GraphCanvas.vue, src/renderer/extensions/vueNodes/composables/*, src/assets/css/style.css, src/renderer/extensions/vueNodes/components/*
Graph rendering filters nodes by viewport state, protects active nodes, and applies low-detail styling below a configurable zoom threshold.
Settings and test coverage
src/platform/settings/constants/coreSettings.ts, src/schemas/apiSchema.ts, src/locales/en/settings.json, browser_tests/fixtures/*, browser_tests/tests/vueNodes/viewportVirtualization.spec.ts
Virtualization and LOD settings are defined, typed, localized, and covered by unit and browser tests.

Virtualized slot geometry

Layer / File(s) Summary
Slot layout lifecycle
src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts, src/renderer/extensions/vueNodes/stores/nodeSlotRegistryStore.ts, src/composables/graph/useGraphNodeManager.ts
Slot layouts survive virtualized unmounts, translate with node movement, invalidate after resizing, and clear on node removal.
Geometry interaction coverage
src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts, browser_tests/tests/vueNodes/interactions/node/move.spec.ts
Tests cover cached slot geometry, collapsed nodes, remounts, grouped drags, and link alignment.

Collapsed size preservation

Layer / File(s) Summary
Visual bounds and measurement
src/lib/litegraph/src/LGraphNode.ts, src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.ts, src/renderer/core/layout/store/*
Collapsed Vue nodes use _collapsed_width; visual bounds updates preserve canonical size and position.
Size and resize coverage
src/lib/litegraph/src/*test.ts, src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.test.ts, browser_tests/tests/vueNodes/interactions/node/resize.spec.ts
Tests cover title modes, repeated measurements, collapse cycles, virtualization remounts, workflow reloads, and scale-aware resize limits.

Widget serialization and restoration

Layer / File(s) Summary
Serialization behavior and tests
src/lib/litegraph/src/LGraphNode.ts, src/lib/litegraph/src/LGraphNode.test.ts, src/lib/litegraph/src/LGraphNode.widgetOrder.test.ts
Widget values use compact positional serialization, skip non-serializable widgets, and require own named properties during restoration.

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

Possibly related issues

Possibly related PRs

Suggested labels: preview

Suggested reviewers: christian-byrne, comfy-pr-bot


Important

Pre-merge checks failed

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

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Adr Compliance For Entity/Litegraph Changes ⚠️ Warning The PR changes LGraphNode widget serialization/restoration and nodeData behavior without migration guidance, triggering ADR 0008 extension-ecosystem concerns. Review ADR 0008 (docs/adr/) and document compatibility or migration guidance for custom node repositories before merging.
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 complete commit subjects to determine whether the check applies.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the main change: Vue node viewport virtualization.
Description check ✅ Passed The description covers the summary, changes, dependencies, review focus, testing, and applicable screenshot information.
✨ 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: 6

🤖 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/fixtures/VueNodeHelpers.ts`:
- Around line 93-130: Update layoutNodesAndEnableVirtualization to make its
virtualization lifecycle explicit: return a disposer alongside the node IDs, or
add JSDoc clearly requiring callers to restore
Comfy.VueNodes.ViewportVirtualization after use. Ensure existing callers are
updated consistently so every invocation performs teardown without relying on
implicit fresh-page state.

In `@browser_tests/tests/vueNodes/interactions/node/resize.spec.ts`:
- Around line 162-257: Replace every collapse-button.dispatchEvent('click') call
in the three tests with the VueNodeFixture.toggleCollapse() helper, using
node.toggleCollapse() for the original fixture and reloadedNode.toggleCollapse()
after workflow reload. Keep the existing assertions and size checks unchanged.

In `@browser_tests/tests/vueNodes/viewportVirtualization.spec.ts`:
- Around line 121-127: Remove the Date.now-based settleDeadline gate from the
frozen mount-set assertion around vueNodes.getNodeIds. Assert the expected
[nodeId] continuously with a bounded expect.poll window or direct assertion
loop, using the existing VIEWPORT_SETTLE_DELAY-related timing configuration
where needed, so any early unmount is detected.

In `@src/assets/css/style.css`:
- Around line 19-55: Replace the fragile Tailwind-class and DOM-position
selectors in the low-detail rule with stable hooks applied to the corresponding
elements in LGraphNode.vue and NodeHeader.vue. Add a consistent marker such as
data-lod="hide" or a dedicated lg-node-detail class to every element currently
intended to be hidden, then target that marker from html.vue-nodes-low-detail
while preserving the existing visibility and pointer-events behavior.

In `@src/platform/settings/constants/coreSettings.ts`:
- Around line 1224-1252: Update the Comfy.VueNodes.LowZoomLOD setting to resolve
the mismatch between its shipped default and the E2E baseline: either change its
defaultValue to false, matching ViewportVirtualization, or remove the suite-wide
override in ComfyPage so tests exercise the enabled default. Keep FullDetailZoom
unchanged.

In
`@src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.test.ts`:
- Around line 310-318: Remove the tautological
testState.nodeLayouts.get(nodeId)?.size assertion from the composable test,
while retaining the batchUpdateNodeBounds call-argument assertion that verifies
preserveSize: true. Leave size-preservation behavior covered by the real
layoutStore implementation tests.
🪄 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: f0642297-8b98-4ca3-92a8-030cd22d0ba2

📥 Commits

Reviewing files that changed from the base of the PR and between fc92a12 and 6040840.

📒 Files selected for processing (30)
  • browser_tests/fixtures/ComfyPage.ts
  • browser_tests/fixtures/VueNodeHelpers.ts
  • browser_tests/tests/vueNodes/interactions/node/move.spec.ts
  • browser_tests/tests/vueNodes/interactions/node/resize.spec.ts
  • browser_tests/tests/vueNodes/viewportVirtualization.spec.ts
  • src/assets/css/style.css
  • src/components/graph/GraphCanvas.vue
  • src/composables/graph/useGraphNodeManager.ts
  • src/lib/litegraph/src/LGraphNode.test.ts
  • src/lib/litegraph/src/LGraphNode.ts
  • src/locales/en/settings.json
  • src/platform/settings/constants/coreSettings.ts
  • src/renderer/core/layout/store/layoutStore.test.ts
  • src/renderer/core/layout/store/layoutStore.ts
  • src/renderer/core/layout/types.ts
  • src/renderer/extensions/vueNodes/components/LGraphNode.test.ts
  • src/renderer/extensions/vueNodes/components/LGraphNode.vue
  • src/renderer/extensions/vueNodes/components/NodeHeader.vue
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts
  • src/renderer/extensions/vueNodes/composables/useViewportVirtualization.test.ts
  • src/renderer/extensions/vueNodes/composables/useViewportVirtualization.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeLOD.test.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeLOD.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.ts
  • src/renderer/extensions/vueNodes/composables/viewportVirtualizationState.ts
  • src/renderer/extensions/vueNodes/interactions/resize/resizeHandleConfig.ts
  • src/renderer/extensions/vueNodes/stores/nodeSlotRegistryStore.ts
  • src/schemas/apiSchema.ts

Comment thread src/assets/css/style.css Resolved

@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/composables/useVueNodeResizeTracking.test.ts`:
- Around line 318-348: Update the test “skips repeated collapsed measurements
matching visual bounds” so it specifically distinguishes the collapsed-node
cachedSize behavior from the late isBoundsEqual guard. Arrange the seeded node
layout’s position/bounds so the late bounds check does not independently skip
the second measurement, while the collapsed measurement matches the cached size
and triggers the intended early skip; retain behavioral assertions for the
absence of resize side effects.
🪄 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: 0674e174-1821-494a-a032-554436289af2

📥 Commits

Reviewing files that changed from the base of the PR and between 6040840 and 19769d6.

📒 Files selected for processing (21)
  • browser_tests/fixtures/VueNodeHelpers.ts
  • browser_tests/tests/vueNodes/interactions/node/resize.spec.ts
  • browser_tests/tests/vueNodes/viewportVirtualization.spec.ts
  • src/assets/css/style.css
  • src/components/graph/widgets/DomWidget.vue
  • src/components/node/CreditBadge.vue
  • src/lib/litegraph/src/LGraphNode.test.ts
  • src/lib/litegraph/src/LGraphNode.ts
  • src/renderer/extensions/vueNodes/VideoPreview.vue
  • src/renderer/extensions/vueNodes/components/AudioPreview.vue
  • src/renderer/extensions/vueNodes/components/ImagePreview.vue
  • src/renderer/extensions/vueNodes/components/LGraphNode.vue
  • src/renderer/extensions/vueNodes/components/LivePreview.vue
  • src/renderer/extensions/vueNodes/components/NodeBadge.vue
  • src/renderer/extensions/vueNodes/components/NodeBadges.vue
  • src/renderer/extensions/vueNodes/components/NodeContent.vue
  • src/renderer/extensions/vueNodes/components/NodeFooter.vue
  • src/renderer/extensions/vueNodes/components/NodeHeader.vue
  • src/renderer/extensions/vueNodes/components/NodeWidgets.vue
  • src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.ts

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 29, 2026
@r-vage

r-vage commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@r-vage
r-vage marked this pull request as ready for review July 29, 2026 23:06
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jul 29, 2026
@r-vage

r-vage commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai rate limit

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Your plan includes PR reviews subject to rate limits. More reviews will be available in 25 minutes.

@r-vage

r-vage commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@r-vage

r-vage commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 3, 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: 7

🤖 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/interactions/node/resize.spec.ts`:
- Around line 123-125: Adjust the scaled minimum-width assertion in the resize
test around getWidth and MIN_NODE_WIDTH to allow a small subpixel tolerance
below the exact MIN_NODE_WIDTH * scale threshold, while preserving the existing
greater-than-or-equal boundary behavior.

In `@src/lib/litegraph/src/LGraphNode.ts`:
- Around line 1051-1063: Add migration guidance to the serialization
documentation around node.serialize, explaining that widgets_values now uses
compact positional indexes by excluding widgets with serialize === false, while
widgets_values_named provides name-based values and is preferred by onConfigure
when present. Include old and new payload examples, and document how custom
onSerialize and onConfigure hooks must write and read both formats while
honoring the restore behavior.

In `@src/lib/litegraph/src/LGraphNode.widgetOrder.test.ts`:
- Around line 188-199: Add a round-trip assertion to the existing “should
serialize named widget values as own properties” test: create a second
LGraphNode with a `__proto__` widget, configure it using the serialized payload
containing `widgets_values_named`, and assert that the widget value is restored
to `prototype value`. Exercise the real `LGraphNode.configure()` behavior while
preserving the existing serialization checks.

In `@src/renderer/extensions/vueNodes/components/LGraphNode.vue`:
- Line 513: Add a node-unmounted emit in LGraphNode’s onUnmounted lifecycle
handler, using the same nodeData.id as node-mounted. Update
useViewportVirtualization.ts to handle node-unmounted by removing that id from
hydratedNodeIds, preserving mount behavior while clearing state when virtualized
DOM components are destroyed.

In `@src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts`:
- Around line 313-322: Update the sizeChanged branch in the slot tracking logic
to preserve and restore slot geometry for virtualized nodes instead of leaving
deleted SlotLayout entries unavailable while the node remains unmounted. Rebuild
each slot’s layout/cache from its stored cachedOffset and the node layout, or
route virtualized resizes through an equivalent non-virtualized
scheduleSlotLayoutSync path; retain the existing behavior for non-virtualized
nodes.

In `@src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.ts`:
- Around line 169-174: Update the collapsed-node handling in the resize callback
so it no longer assigns directly to liteNode._collapsed_width. Route the width
update through the existing layout/command pathway or an exposed LGraphNode
accessor, ensuring any downstream update is serializable and CRDT-compatible.

In `@src/renderer/extensions/vueNodes/interactions/resize/resizeHandleConfig.ts`:
- Around line 15-39: Re-check the svgPositionClasses offsets in the resize
handle configuration after the positionClasses changed to -3 offsets. Adjust the
top, bottom, left, and right SVG positioning values for the NE, SW, and related
corner entries so each chevron remains aligned with its node corner.
🪄 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: 6f03780c-5472-4f54-83d7-e76bf3020df4

📥 Commits

Reviewing files that changed from the base of the PR and between 8291e69 and 98896c5.

📒 Files selected for processing (42)
  • browser_tests/fixtures/ComfyPage.ts
  • browser_tests/fixtures/VueNodeHelpers.ts
  • browser_tests/tests/vueNodes/interactions/node/move.spec.ts
  • browser_tests/tests/vueNodes/interactions/node/resize.spec.ts
  • browser_tests/tests/vueNodes/viewportVirtualization.spec.ts
  • src/assets/css/style.css
  • src/components/graph/GraphCanvas.vue
  • src/components/graph/widgets/DomWidget.vue
  • src/components/node/CreditBadge.vue
  • src/composables/graph/useGraphNodeManager.ts
  • src/lib/litegraph/src/LGraphNode.test.ts
  • src/lib/litegraph/src/LGraphNode.ts
  • src/lib/litegraph/src/LGraphNode.widgetOrder.test.ts
  • src/locales/en/settings.json
  • src/platform/settings/constants/coreSettings.ts
  • src/renderer/core/layout/store/layoutStore.test.ts
  • src/renderer/core/layout/store/layoutStore.ts
  • src/renderer/core/layout/types.ts
  • src/renderer/extensions/vueNodes/VideoPreview.vue
  • src/renderer/extensions/vueNodes/components/AudioPreview.vue
  • src/renderer/extensions/vueNodes/components/ImagePreview.vue
  • src/renderer/extensions/vueNodes/components/LGraphNode.test.ts
  • src/renderer/extensions/vueNodes/components/LGraphNode.vue
  • src/renderer/extensions/vueNodes/components/LivePreview.vue
  • src/renderer/extensions/vueNodes/components/NodeBadge.vue
  • src/renderer/extensions/vueNodes/components/NodeBadges.vue
  • src/renderer/extensions/vueNodes/components/NodeContent.vue
  • src/renderer/extensions/vueNodes/components/NodeFooter.vue
  • src/renderer/extensions/vueNodes/components/NodeHeader.vue
  • src/renderer/extensions/vueNodes/components/NodeWidgets.vue
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts
  • src/renderer/extensions/vueNodes/composables/useViewportVirtualization.test.ts
  • src/renderer/extensions/vueNodes/composables/useViewportVirtualization.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeLOD.test.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeLOD.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.ts
  • src/renderer/extensions/vueNodes/composables/viewportVirtualizationState.ts
  • src/renderer/extensions/vueNodes/interactions/resize/resizeHandleConfig.ts
  • src/renderer/extensions/vueNodes/stores/nodeSlotRegistryStore.ts
  • src/schemas/apiSchema.ts

Comment thread src/lib/litegraph/src/LGraphNode.ts Resolved
@r-vage

r-vage commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 3, 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: 9

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/composables/useSlotElementTracking.test.ts (1)

111-121: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the containers that createSlotElement appends to document.body.

createSlotElement appends a container to document.body on every call and never removes it. Each mountAndRegisterSlot call therefore leaves a detached-but-connected [data-node-id] container behind. The remount test at lines 207-247 calls it three times per case. Stale containers carrying the same NODE_ID accumulate across tests, which weakens the isolation the new virtualization tests depend on. Confirm that a shared hook clears document.body, or clear it explicitly.

#!/bin/bash
# Description: Check for document.body cleanup hooks in the test file and shared setup.
set -euo pipefail

echo "== hooks in the test file"
rg -n -C 4 'beforeEach|afterEach|document.body|cleanup' src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts

echo "== global vitest setup files"
fd -t f 'vitest.config' . --max-depth 2 --exec cat
fd -t f -g '*setup*.ts' tests-ui src --max-depth 3

As per path instructions, .agents/checks/test-quality.md requires that tests "isolate mutable state".

🤖 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/useSlotElementTracking.test.ts`
around lines 111 - 121, Update mountAndRegisterSlot and the surrounding test
setup to remove every container appended by createSlotElement from document.body
after each use, either via a verified shared cleanup hook or explicit cleanup.
Ensure repeated calls in remount tests and separate tests cannot leave stale
[data-node-id] containers behind.

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 `@browser_tests/tests/vueNodes/interactions/node/move.spec.ts`:
- Around line 444-479: Update the virtualization setup and teardown in this test
to capture the existing Comfy.VueNodes.ViewportVirtualization value before
enabling it, then restore that captured value in finally instead of hardcoding
false. Reuse or extract the capture-and-restore behavior from
VueNodeHelpers.layoutNodesAndEnableVirtualization without applying its
node-repositioning behavior, and avoid duplicating the setting identifier.

In `@browser_tests/tests/vueNodes/interactions/node/resize.spec.ts`:
- Line 203: Replace the coordinate-based mouse.click deselection in the resize
interaction test with the documented VueNodeHelpers.clearSelection() helper,
ensuring the subsequent protected-mount count assertion is evaluated with no
node selected.
- Around line 225-230: Loosen the width and height tolerance in the post-remount
DOM geometry assertions using the existing node.boundingBox polling checks,
changing both to accept differences within one pixel while leaving the exact
canonical size assertion unchanged.

In `@browser_tests/tests/vueNodes/viewportVirtualization.spec.ts`:
- Around line 33-36: Update the viewport virtualization assertions using
getNodeIds() and firstViewportIds to compare membership and collection length
rather than array equality, so DOM order and graph.nodes order do not affect the
test. Apply the same order-insensitive assertion change to the corresponding
assertion around the second viewport check.

In `@src/lib/litegraph/src/LGraphNode.test.ts`:
- Around line 589-590: Update the test setup/teardown around setup(), the nested
afterEach, and the Vue-mode tests to isolate shared state: capture the original
LiteGraph.vueNodesMode and layoutStore source before mutation, then restore both
in teardown/finally. Ensure layoutStore.setSource(LayoutSource.Vue) cannot leak
into subsequent tests while preserving the existing serialized-node restoration
behavior.

In `@src/renderer/extensions/vueNodes/components/LGraphNode.vue`:
- Line 209: Update the resize-handle element in LGraphNode.vue from
data-node-lod="hide" to data-node-lod="show" so corner handles remain visible
and interactive at low detail. Add a browser test covering resize initiation at
the low-detail threshold if resizing is expected to remain available.

In `@src/renderer/extensions/vueNodes/components/NodeWidgets.vue`:
- Around line 29-34: Move the linked input slot dot, identified by its
data-node-lod binding, outside the widget wrapper marked data-node-lod="hide"
while preserving its linked-state visibility behavior and existing layout
semantics.

In `@src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts`:
- Around line 207-247: Ensure the component created by mountAndRegisterSlot in
the repeated-remount test is always cleaned up when an in-loop assertion fails.
Wrap the remount/assertion loop in try/finally and unmount the current mounted
instance in finally, or remove the manual cleanup and rely on the test library’s
auto-cleanup.

In `@src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts`:
- Around line 296-311: Update subscribeToNodeLayoutChanges to snapshot the
primitive position and size values rather than retaining previousLayout as a
layout-object reference. Compare currentLayout against those snapshots for
sizeChanged and positionChanged, then refresh the snapshots after each
notification so behavior remains correct whether layoutStore mutates objects in
place or replaces them.

---

Outside diff comments:
In `@src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts`:
- Around line 111-121: Update mountAndRegisterSlot and the surrounding test
setup to remove every container appended by createSlotElement from document.body
after each use, either via a verified shared cleanup hook or explicit cleanup.
Ensure repeated calls in remount tests and separate tests cannot leave stale
[data-node-id] containers behind.
🪄 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: bd26cb54-756f-4b8c-a2da-d3765d9a83c1

📥 Commits

Reviewing files that changed from the base of the PR and between 8291e69 and 2de20d6.

📒 Files selected for processing (42)
  • browser_tests/fixtures/ComfyPage.ts
  • browser_tests/fixtures/VueNodeHelpers.ts
  • browser_tests/tests/vueNodes/interactions/node/move.spec.ts
  • browser_tests/tests/vueNodes/interactions/node/resize.spec.ts
  • browser_tests/tests/vueNodes/viewportVirtualization.spec.ts
  • src/assets/css/style.css
  • src/components/graph/GraphCanvas.vue
  • src/components/graph/widgets/DomWidget.vue
  • src/components/node/CreditBadge.vue
  • src/composables/graph/useGraphNodeManager.ts
  • src/lib/litegraph/src/LGraphNode.test.ts
  • src/lib/litegraph/src/LGraphNode.ts
  • src/lib/litegraph/src/LGraphNode.widgetOrder.test.ts
  • src/locales/en/settings.json
  • src/platform/settings/constants/coreSettings.ts
  • src/renderer/core/layout/store/layoutStore.test.ts
  • src/renderer/core/layout/store/layoutStore.ts
  • src/renderer/core/layout/types.ts
  • src/renderer/extensions/vueNodes/VideoPreview.vue
  • src/renderer/extensions/vueNodes/components/AudioPreview.vue
  • src/renderer/extensions/vueNodes/components/ImagePreview.vue
  • src/renderer/extensions/vueNodes/components/LGraphNode.test.ts
  • src/renderer/extensions/vueNodes/components/LGraphNode.vue
  • src/renderer/extensions/vueNodes/components/LivePreview.vue
  • src/renderer/extensions/vueNodes/components/NodeBadge.vue
  • src/renderer/extensions/vueNodes/components/NodeBadges.vue
  • src/renderer/extensions/vueNodes/components/NodeContent.vue
  • src/renderer/extensions/vueNodes/components/NodeFooter.vue
  • src/renderer/extensions/vueNodes/components/NodeHeader.vue
  • src/renderer/extensions/vueNodes/components/NodeWidgets.vue
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts
  • src/renderer/extensions/vueNodes/composables/useViewportVirtualization.test.ts
  • src/renderer/extensions/vueNodes/composables/useViewportVirtualization.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeLOD.test.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeLOD.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.test.ts
  • src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.ts
  • src/renderer/extensions/vueNodes/composables/viewportVirtualizationState.ts
  • src/renderer/extensions/vueNodes/interactions/resize/resizeHandleConfig.ts
  • src/renderer/extensions/vueNodes/stores/nodeSlotRegistryStore.ts
  • src/schemas/apiSchema.ts

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 3, 2026
@r-vage

r-vage commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

closed because there is no speed improvement anymore with ecs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant