fix(vueNodes): sync node size changes from extensions to Vue components#7993
fix(vueNodes): sync node size changes from extensions to Vue components#7993
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (22)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the 📝 WalkthroughWalkthroughReplaces direct node pos/size mutations with a public Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Caller (LGraph / Canvas / arrange)
participant Node as LGraphNode
participant Layout as LayoutStore
participant Vue as LGraphNode.vue
Caller->>Node: setPos(x,y)
Node->>Node: update internal pos/size
Node->>Layout: emit moveNode / resizeNode mutation
Layout->>Vue: notify layout change (subscription)
Vue->>Vue: update CSS vars / UI (if applicable)
Possibly related PRs
Suggested reviewers
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. Comment |
🎭 Playwright Tests: ❌ FailedResults: 467 passed, 20 failed, 2 flaky, 8 skipped (Total: 497) ❌ Failed Tests📊 Browser Reports
|
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 02/05/2026, 03:10:15 AM UTC 🔗 Links🎉 Your Storybook is ready for review! |
Bundle Size ReportSummary
Category Glance Per-category breakdownApp Entry Points — 22.5 kB (baseline 22.5 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 840 kB (baseline 840 kB) • 🔴 +752 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 69 kB (baseline 69 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 9 added / 9 removed Panels & Settings — 410 kB (baseline 410 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 12 added / 12 removed User & Accounts — 16 kB (baseline 16 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 5 added / 5 removed Editors & Dialogs — 3.47 kB (baseline 3.47 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 2 added / 2 removed UI Components — 37.8 kB (baseline 37.8 kB) • ⚪ 0 BReusable component library chunks
Status: 5 added / 5 removed Data & Services — 2.1 MB (baseline 2.1 MB) • 🔴 +34 BStores, services, APIs, and repositories
Status: 11 added / 11 removed Utilities & Hooks — 234 kB (baseline 234 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 12 added / 12 removed Vendor & Third-Party — 9.37 MB (baseline 9.37 MB) • ⚪ 0 BExternal libraries and shared vendor chunks
Other — 7.08 MB (baseline 7.08 MB) • ⚪ 0 BBundles that do not match a named category
Status: 49 added / 49 removed |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In @src/lib/litegraph/src/LGraphCanvas.ts:
- Around line 8519-8526: The applyNodePositionUpdates function currently calls
node.setPos() in a loop which triggers mutations.moveNode() per node; instead
collect all node id-to-position mappings and call
layoutStore.batchUpdateNodeBounds() once (as shown in the other usage) so
updates are wrapped in a single Yjs transaction; locate applyNodePositionUpdates
and replace the per-node node.setPos(...) loop with a single call to
layoutStore.batchUpdateNodeBounds(...) supplying the aggregated positions (or
alternatively implement a frame-queued flush that batches node.setPos calls) to
avoid N separate mutations.
- Around line 4013-4022: The loop currently sets positions directly (using
LGraphNode.setPos(...) and direct pos mutation) which bypasses item.move and
leaves reroute layout entries stale; replace both branches to compute dx = newX
- item.pos[0], dy = newY - item.pos[1] and call item.move(dx, dy, true) for
every item (including instances of LGraphNode and Reroute) so the movement API
and layoutMutations.moveReroute() are invoked and the layout store stays in
sync.
In @src/lib/litegraph/src/LGraphNode.ts:
- Around line 495-502: The size setter performs layout updates unconditionally;
add the same early-return check used in the pos setter to avoid unnecessary
mutations by comparing current size to the incoming value and returning if
unchanged (e.g., if (this.size[0] === value[0] && this.size[1] === value[1])
return). Keep the rest intact: only call useLayoutMutations() and
mutations.resizeNode(String(this.id), { width: value[0], height: value[1] })
when the size actually changes.
- Around line 473-477: The setter currently calls useLayoutMutations() and emits
mutations.setSource/LayoutSource.Canvas and mutations.moveNode unconditionally,
causing redundant updates and repeated composable calls; modify the setter to
cache the result of useLayoutMutations() (e.g., store a local/instance-level
reference) and add change detection comparing the new coordinates to the current
node position before calling mutations.setSource or mutations.moveNode so you
return early when x/y are unchanged, thereby avoiding unnecessary store
operations and composable overhead.
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
src/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vue
🧰 Additional context used
📓 Path-based instructions (13)
src/**/*.{vue,ts}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{vue,ts}: Leverage VueUse functions for performance-enhancing styles
Implement proper error handling
Use vue-i18n in composition API for any string literals. Place new translation entries in src/locales/en/main.json
Files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vue
src/**/*.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.ts: Use es-toolkit for utility functions
Use TypeScript for type safety
src/**/*.ts: Derive component types usingvue-component-type-helpers(ComponentProps,ComponentSlots) instead of separate type files
Use es-toolkit for utility functions
Minimize the surface area (exported values) of each module and composable
Favor pure functions, especially testable ones
Files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
src/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
src/**/*.{ts,tsx,vue}: Sanitize HTML with DOMPurify to prevent XSS attacks
Avoid using @ts-expect-error; use proper TypeScript types instead
Use es-toolkit for utility functions instead of other utility libraries
Implement proper TypeScript types throughout the codebase
src/**/*.{ts,tsx,vue}: Use separateimport typestatements instead of inlinetypein mixed imports
Apply Prettier formatting with 2-space indentation, single quotes, no trailing semicolons, 80-character width
Sort and group imports by plugin, runpnpm formatbefore committing
Never useanytype - use proper TypeScript types
Never useas anytype assertions - fix the underlying type issue
Write code that is expressive and self-documenting - avoid unnecessary comments
Do not add or retain redundant comments - clean as you go
Avoid mutable state - prefer immutability and assignment at point of declaration
Watch out for Code Smells and refactor to avoid them
Files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vue
src/**/*.{vue,ts,tsx}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Follow Vue 3 composition API style guide
Files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vue
src/lib/litegraph/**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (src/lib/litegraph/CLAUDE.md)
src/lib/litegraph/**/*.{js,ts,jsx,tsx}: Run ESLint instead of manually figuring out whitespace fixes or other trivial style concerns using thepnpm lint:fixcommand
Take advantage ofTypedArraysubarraywhen appropriate
Thesizeandposproperties ofRectangleshare the same array buffer (subarray); they may be used to set the rectangle's size and position
Prefer single lineifsyntax over adding curly braces, when the statement has a very concise expression and concise, single line statement
Do not replace&&=or||=with=when there is no reason to do so. If you do find a reason to remove either&&=or||=, leave a comment explaining why the removal occurred
When writing methods, prefer returning idiomatic JavaScriptundefinedovernull
Files:
src/lib/litegraph/src/utils/arrange.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
src/lib/litegraph/**/*.{ts,tsx}
📄 CodeRabbit inference engine (src/lib/litegraph/CLAUDE.md)
Type assertions are an absolute last resort. In almost all cases, they are a crutch that leads to brittle code
Files:
src/lib/litegraph/src/utils/arrange.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
src/**/*.{ts,vue}
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.{ts,vue}: Usereffor reactive state,computed()for derived values, andwatch/watchEffectfor side effects in Composition API
Avoid usingrefwithwatchif acomputedwould suffice - minimize refs and derived state
Useprovide/injectfor dependency injection only when simpler alternatives (Store or shared composable) won't work
Leverage VueUse functions for performance-enhancing composables
Use VueUse function for useI18n in composition API for string literals
Files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vue
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.{ts,tsx}: Keep functions short and functional
Minimize nesting (if statements, for loops, etc.)
Use function declarations instead of function expressions when possible
Files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
src/**/{composables,components}/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Clean up subscriptions in state management to prevent memory leaks
Files:
src/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vue
src/**/{components,composables}/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (src/CLAUDE.md)
Use vue-i18n for ALL user-facing strings by adding them to
src/locales/en/main.json
Files:
src/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vue
+(tests-ui|src)/**/*.test.ts
📄 CodeRabbit inference engine (AGENTS.md)
+(tests-ui|src)/**/*.test.ts: Unit and component tests belong intests-ui/orsrc/**/*.test.tsusing Vitest
Write tests for all changes, especially bug fixes to catch future regressions
Do not write tests dependent on non-behavioral features like utility classes or styles
Do not write tests that just test the mocks - ensure tests fail when code behaves unexpectedly
Leverage Vitest's utilities for mocking where possible
Keep module mocks contained - do not use global mutable state within test files; usevi.hoisted()if necessary
Use Vue Test Utils for Component testing and follow best practices for making components easy to test
Aim for behavioral coverage of critical and new features in unit tests
Files:
src/renderer/extensions/vueNodes/components/LGraphNode.test.ts
+(tests-ui|src|browser_tests)/**/*.+(test.ts|spec.ts)
📄 CodeRabbit inference engine (AGENTS.md)
+(tests-ui|src|browser_tests)/**/*.+(test.ts|spec.ts): Do not write change detector tests - avoid tests that only assert default values
Be parsimonious in testing - do not write redundant tests
Don't Mock What You Don't Own
Files:
src/renderer/extensions/vueNodes/components/LGraphNode.test.ts
src/**/*.vue
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.vue: Use the Vue 3 Composition API instead of the Options API when writing Vue components (exception: when overriding or extending PrimeVue components for compatibility)
Use setup() function for component logic
Utilize ref and reactive for reactive state
Implement computed properties with computed()
Use watch and watchEffect for side effects
Implement lifecycle hooks with onMounted, onUpdated, etc.
Utilize provide/inject for dependency injection
Use vue 3.5 style of default prop declaration
Use Tailwind CSS for styling
Implement proper props and emits definitions
Utilize Vue 3's Teleport component when needed
Use Suspense for async components
Follow Vue 3 style guide and naming conventions
src/**/*.vue: Use Vue 3 Single File Components (SFCs) with Composition API only
Use<script setup lang="ts">for component logic in Vue SFCs
Avoid<style>blocks in Vue components - use Tailwind 4 styling instead
Use vue-i18n for all string literals in Vue components - place translation entries insrc/locales/en/main.json
Use Tailwind utility classes instead ofdark:variant - use semantic values fromstyle.csstheme (e.g.,bg-node-component-surface)
Usecn()utility from@/utils/tailwindUtilfor merging Tailwind class names instead of:class="[]"or hardcoding
Never use!importantor!Tailwind prefix - fix interfering classes instead
Use Tailwind fraction utilities instead of arbitrary percentage values (e.g.,w-4/5instead ofw-[80%])
Use TypeScript Vue 3.5 style default prop declaration with reactive props destructuring - avoidwithDefaultsor runtime props
PreferdefineModelover separately defining a prop and emit for v-model bindings
Define slots via template usage, not viadefineSlots
Use same-name shorthand for slot prop bindings (e.g.,:isExpandedinstead of:is-expanded="isExpanded")
Do not import Vue macros unnecessarily
Avoid new usage of PrimeVue components
Use Tailwind's plurals system via i18n instead of hardcoding ...
Files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
🧠 Learnings (44)
📓 Common learnings
Learnt from: simula-r
Repo: Comfy-Org/ComfyUI_frontend PR: 7252
File: src/renderer/extensions/vueNodes/components/ImagePreview.vue:151-158
Timestamp: 2025-12-11T03:55:57.926Z
Learning: In src/renderer/extensions/vueNodes/components/ImagePreview.vue and LGraphNode.vue, keyboard navigation for image galleries should respond to node-level focus (via keyEvent injection from LGraphNode), not require focus within the image preview wrapper itself. This allows users to navigate the gallery with arrow keys immediately when the node is focused/selected.
📚 Learning: 2025-11-24T19:47:56.371Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/lib/litegraph/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:56.371Z
Learning: Applies to src/lib/litegraph/**/*.{js,ts,jsx,tsx} : The `size` and `pos` properties of `Rectangle` share the same array buffer (`subarray`); they may be used to set the rectangle's size and position
Applied to files:
src/lib/litegraph/src/utils/arrange.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
📚 Learning: 2025-11-24T19:47:56.371Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/lib/litegraph/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:56.371Z
Learning: Applies to src/lib/litegraph/**/*.{js,ts,jsx,tsx} : Do not replace `&&=` or `||=` with `=` when there is no reason to do so. If you do find a reason to remove either `&&=` or `||=`, leave a comment explaining why the removal occurred
Applied to files:
src/lib/litegraph/src/utils/arrange.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
📚 Learning: 2025-11-24T19:47:56.371Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/lib/litegraph/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:56.371Z
Learning: Applies to src/lib/litegraph/**/*.{test,spec}.{ts,tsx} : Use provided test helpers `createTestSubgraph` and `createTestSubgraphNode` from `./fixtures/subgraphHelpers` for consistent subgraph test setup
Applied to files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
📚 Learning: 2025-11-24T19:47:56.371Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/lib/litegraph/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:56.371Z
Learning: Applies to src/lib/litegraph/**/*.{js,ts,jsx,tsx} : Take advantage of `TypedArray` `subarray` when appropriate
Applied to files:
src/lib/litegraph/src/utils/arrange.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
📚 Learning: 2025-12-09T03:39:54.501Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7169
File: src/platform/remote/comfyui/jobs/jobTypes.ts:1-107
Timestamp: 2025-12-09T03:39:54.501Z
Learning: In the ComfyUI_frontend project, Zod is on v3.x. Do not suggest Zod v4 standalone validators (z.uuid, z.ulid, z.cuid2, z.nanoid) until an upgrade to Zod 4 is performed. When reviewing TypeScript files (e.g., src/platform/remote/comfyui/jobs/jobTypes.ts) validate against Zod 3 capabilities and avoid introducing v4-specific features; flag any proposal to upgrade or incorporate v4-only validators and propose staying with compatible 3.x patterns.
Applied to files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
📚 Learning: 2025-12-13T11:03:11.264Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7416
File: src/stores/imagePreviewStore.ts:5-7
Timestamp: 2025-12-13T11:03:11.264Z
Learning: In the ComfyUI_frontend repository, lint rules require keeping 'import type' statements separate from non-type imports, even if importing from the same module. Do not suggest consolidating them into a single import statement. Ensure type imports remain on their own line (import type { ... } from 'module') and regular imports stay on separate lines.
Applied to files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
📚 Learning: 2025-12-17T00:40:09.635Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7537
File: src/components/ui/button/Button.stories.ts:45-55
Timestamp: 2025-12-17T00:40:09.635Z
Learning: Prefer pure function declarations over function expressions (e.g., use function foo() { ... } instead of const foo = () => { ... }) for pure functions in the repository. Function declarations are more functional-leaning, offer better hoisting clarity, and can improve readability and tooling consistency. Apply this guideline across TypeScript files in Comfy-Org/ComfyUI_frontend, including story and UI component code, except where a function expression is semantically required (e.g., callbacks, higher-order functions with closures).
Applied to files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
📚 Learning: 2025-12-30T22:22:33.836Z
Learnt from: kaili-yang
Repo: Comfy-Org/ComfyUI_frontend PR: 7805
File: src/composables/useCoreCommands.ts:439-439
Timestamp: 2025-12-30T22:22:33.836Z
Learning: When accessing reactive properties from Pinia stores in TypeScript files, avoid using .value on direct property access (e.g., useStore().isOverlayExpanded). Pinia auto-wraps refs when accessed directly, returning the primitive value. The .value accessor is only needed when destructuring store properties or when using storeToRefs().
Applied to files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
📚 Learning: 2025-12-11T12:25:15.470Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 7358
File: src/components/dialog/content/signin/SignUpForm.vue:45-54
Timestamp: 2025-12-11T12:25:15.470Z
Learning: This repository uses CI automation to format code (pnpm format). Do not include manual formatting suggestions in code reviews for Comfy-Org/ComfyUI_frontend. If formatting issues are detected, rely on the CI formatter or re-run pnpm format. Focus reviews on correctness, readability, performance, accessibility, and maintainability rather than style formatting.
Applied to files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2026-01-12T17:39:27.738Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7906
File: src/components/sidebar/tabs/AssetsSidebarTab.vue:545-552
Timestamp: 2026-01-12T17:39:27.738Z
Learning: In Vue/TypeScript files (src/**/*.{ts,tsx,vue}), prefer if/else statements over ternary operators when performing side effects or actions (e.g., mutating state, calling methods with side effects). Ternaries should be reserved for computing and returning values.
Applied to files:
src/lib/litegraph/src/utils/arrange.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2026-01-09T02:07:54.558Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7898
File: src/composables/usePaste.test.ts:248-248
Timestamp: 2026-01-09T02:07:54.558Z
Learning: In test files (e.g., any .test.ts or .test.tsx under src/...), when you create mock objects that partially implement an interface (such as LGraphNode), prefer casting with as Partial<InterfaceType> as InterfaceType rather than as any or as unknown as InterfaceType. This makes the incomplete implementation explicit while preserving type safety, improving readability and maintainability of tests.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.test.ts
📚 Learning: 2025-11-24T19:47:56.371Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/lib/litegraph/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:56.371Z
Learning: Applies to src/lib/litegraph/**/*.{test,spec}.{js,ts,jsx,tsx} : When adding features, always write vitest unit tests using cursor rules in @.cursor
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/lib/litegraph/src/LGraph.ts
📚 Learning: 2025-12-11T03:55:57.926Z
Learnt from: simula-r
Repo: Comfy-Org/ComfyUI_frontend PR: 7252
File: src/renderer/extensions/vueNodes/components/ImagePreview.vue:151-158
Timestamp: 2025-12-11T03:55:57.926Z
Learning: In src/renderer/extensions/vueNodes/components/ImagePreview.vue and LGraphNode.vue, keyboard navigation for image galleries should respond to node-level focus (via keyEvent injection from LGraphNode), not require focus within the image preview wrapper itself. This allows users to navigate the gallery with arrow keys immediately when the node is focused/selected.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.test.ts
📚 Learning: 2025-11-24T19:47:22.909Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: browser_tests/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:22.909Z
Learning: Applies to browser_tests/**/*.{e2e,spec}.{ts,tsx,js,jsx} : Test across multiple viewports
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.test.ts
📚 Learning: 2025-12-10T03:09:13.807Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7303
File: src/components/topbar/CurrentUserPopover.test.ts:199-205
Timestamp: 2025-12-10T03:09:13.807Z
Learning: In test files, prefer selecting or asserting on accessible properties (text content, aria-label, role, accessible name) over data-testid attributes. This ensures tests validate actual user-facing behavior and accessibility, reducing reliance on implementation details like test IDs.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.test.ts
📚 Learning: 2025-12-30T01:31:04.927Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7797
File: tests-ui/tests/lib/litegraph/src/widgets/ComboWidget.test.ts:648-648
Timestamp: 2025-12-30T01:31:04.927Z
Learning: In Vitest v4, when mocking functions that may be called as constructors (using new), the mock implementation must use function() or class syntax rather than an arrow function. Arrow mocks can cause '<anonymous> is not a constructor' errors. This is a breaking change from Vitest v3 where mocks could use an arrow function. Apply this guideline to test files that mock constructor-like calls (e.g., in tests under tests-ui, such as ComboWidget.test.ts) and ensure mock implementations are defined with function() { ... } or class { ... } to preserve constructor behavior.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.test.ts
📚 Learning: 2026-01-08T02:40:15.482Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7894
File: src/renderer/extensions/vueNodes/widgets/components/WidgetToggleSwitch.test.ts:11-14
Timestamp: 2026-01-08T02:40:15.482Z
Learning: In TypeScript test files (e.g., any test under src), avoid duplicating interface/type definitions. Import real type definitions from the component modules under test and reference them directly, so there is a single source of truth and to prevent type drift. This improves maintainability and consistency across tests.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.test.ts
📚 Learning: 2025-11-24T19:47:56.371Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/lib/litegraph/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:56.371Z
Learning: Applies to src/lib/litegraph/**/*.{test,spec}.{ts,tsx} : When writing tests for subgraph-related code, always import from the barrel export at `@/lib/litegraph/src/litegraph` to avoid circular dependency issues
Applied to files:
src/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.ts
📚 Learning: 2025-11-24T19:47:56.371Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/lib/litegraph/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:56.371Z
Learning: Applies to src/lib/litegraph/**/*.{ts,tsx} : Type assertions are an absolute last resort. In almost all cases, they are a crutch that leads to brittle code
Applied to files:
src/lib/litegraph/src/LGraph.ts
📚 Learning: 2026-01-09T02:07:59.035Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7898
File: src/composables/usePaste.test.ts:248-248
Timestamp: 2026-01-09T02:07:59.035Z
Learning: In test files at src/**/*.test.ts, when creating mock objects that partially implement an interface (e.g., LGraphNode), use `as Partial<InterfaceType> as InterfaceType` instead of `as any` or `as unknown as InterfaceType` to explicitly acknowledge the incomplete implementation while maintaining type safety.
Applied to files:
src/lib/litegraph/src/LGraph.ts
📚 Learning: 2025-11-24T19:47:56.371Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/lib/litegraph/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:56.371Z
Learning: Applies to src/lib/litegraph/**/*.{js,ts,jsx,tsx} : When writing methods, prefer returning idiomatic JavaScript `undefined` over `null`
Applied to files:
src/lib/litegraph/src/LGraph.ts
📚 Learning: 2025-12-11T03:55:51.755Z
Learnt from: simula-r
Repo: Comfy-Org/ComfyUI_frontend PR: 7252
File: src/renderer/extensions/vueNodes/components/ImagePreview.vue:151-158
Timestamp: 2025-12-11T03:55:51.755Z
Learning: In Vue components under src/renderer/extensions/vueNodes (e.g., ImagePreview.vue and LGraphNode.vue), implement image gallery keyboard navigation so that it responds to the node's focus state rather than requiring focus inside the image preview wrapper. Achieve this by wiring keyEvent handling at the node focus level and injecting or propagating key events (arrow keys) to the gallery when the node is focused/selected. This improves accessibility and aligns navigation with node-level focus behavior.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2026-01-10T00:24:17.695Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T00:24:17.695Z
Learning: Applies to src/**/*.{ts,vue} : Use `ref` for reactive state, `computed()` for derived values, and `watch`/`watchEffect` for side effects in Composition API
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-12-30T22:22:38.162Z
Learnt from: kaili-yang
Repo: Comfy-Org/ComfyUI_frontend PR: 7805
File: src/composables/useCoreCommands.ts:439-439
Timestamp: 2025-12-30T22:22:38.162Z
Learning: In Pinia setup stores, when accessing reactive properties directly via `useStore().property` pattern (e.g., `useQueueUIStore().isOverlayExpanded`), Pinia automatically unwraps refs and returns the primitive value. The `.value` accessor is only needed when destructuring store properties or using `storeToRefs()`.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-12-04T21:43:49.363Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7137
File: src/components/rightSidePanel/parameters/TabParameters.vue:10-0
Timestamp: 2025-12-04T21:43:49.363Z
Learning: Vue 3.5+ supports reactive props destructure in <script setup>. Destructuring props directly (e.g., `const { nodes } = defineProps<{ nodes: LGraphNode[] }>()`) maintains reactivity through compiler transformation. This is the recommended modern approach and does not require using `props.x` or `toRef`/`toRefs`.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2026-01-10T00:24:17.695Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T00:24:17.695Z
Learning: Applies to src/**/*.{ts,vue} : Avoid using `ref` with `watch` if a `computed` would suffice - minimize refs and derived state
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-11-24T19:47:45.616Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/components/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:45.616Z
Learning: Applies to src/components/**/*.vue : Use ref/reactive for state management in Vue 3 Composition API
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-11-24T19:47:02.860Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T19:47:02.860Z
Learning: Applies to src/**/*.vue : Utilize ref and reactive for reactive state
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2026-01-10T00:24:17.695Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T00:24:17.695Z
Learning: Applies to src/**/*.vue : Use `<script setup lang="ts">` for component logic in Vue SFCs
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-11-24T19:47:45.616Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/components/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:45.616Z
Learning: Applies to src/components/**/*.vue : Use setup() function in Vue 3 Composition API
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2026-01-10T00:24:17.695Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T00:24:17.695Z
Learning: Applies to src/**/*.{ts,vue} : Use VueUse function for useI18n in composition API for string literals
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2026-01-10T00:24:17.695Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T00:24:17.695Z
Learning: Applies to src/**/*.{ts,vue} : Leverage VueUse functions for performance-enhancing composables
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-11-24T19:47:02.860Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T19:47:02.860Z
Learning: Applies to src/**/*.{vue,ts} : Leverage VueUse functions for performance-enhancing styles
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-11-24T19:47:45.616Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/components/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:45.616Z
Learning: Applies to src/components/**/*.{vue,ts,js} : Use useIntersectionObserver for visibility detection instead of custom scroll handlers
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-11-24T19:47:45.616Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/components/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:45.616Z
Learning: Applies to src/components/**/*.{vue,ts,js} : Use existing VueUse composables (such as useElementHover) instead of manually managing event listeners
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-12-09T03:49:52.828Z
Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 6300
File: src/platform/updates/components/WhatsNewPopup.vue:5-13
Timestamp: 2025-12-09T03:49:52.828Z
Learning: In Vue files across the ComfyUI_frontend repo, when a button is needed, prefer the repo's common button components from src/components/button/ (IconButton.vue, TextButton.vue, IconTextButton.vue) over plain HTML <button> elements. These components wrap PrimeVue with the project’s design system styling. Use only the common button components for consistency and theming, and import them from src/components/button/ as needed.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-12-09T21:40:12.361Z
Learnt from: benceruleanlu
Repo: Comfy-Org/ComfyUI_frontend PR: 7297
File: src/components/actionbar/ComfyActionbar.vue:33-43
Timestamp: 2025-12-09T21:40:12.361Z
Learning: In Vue single-file components, allow inline Tailwind CSS class strings for static classes and avoid extracting them into computed properties solely for readability. Prefer keeping static class names inline for simplicity and performance. For dynamic or conditional classes, use Vue bindings (e.g., :class) to compose classes.
Applies to all Vue files in the repository (e.g., src/**/*.vue) where Tailwind utilities are used for static styling.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-12-16T22:26:49.463Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7537
File: src/components/ui/button/Button.vue:17-17
Timestamp: 2025-12-16T22:26:49.463Z
Learning: In Vue 3.5+ with <script setup>, when using defineProps<Props>() with partial destructuring (e.g., const { as = 'button', class: customClass = '' } = defineProps<Props>() ), props that are not destructured (e.g., variant, size) stay accessible by name in the template scope. This pattern is valid: you can destructure only a subset of props for convenience while referencing the remaining props directly in template expressions. Apply this guideline to Vue components across the codebase (all .vue files).
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-12-22T21:36:08.369Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7649
File: src/platform/cloud/subscription/components/PricingTable.vue:185-201
Timestamp: 2025-12-22T21:36:08.369Z
Learning: In Vue components, avoid creating single-use variants for common UI components (e.g., Button and other shared components). Aim for reusable variants that cover multiple use cases. It’s acceptable to temporarily mix variant props with inline Tailwind classes when a styling need is unique to one place, but plan and consolidate into shared, reusable variants as patterns emerge across the codebase.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2026-01-08T02:26:18.357Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7893
File: src/components/button/IconGroup.vue:5-6
Timestamp: 2026-01-08T02:26:18.357Z
Learning: In components that use the cn utility from '@/utils/tailwindUtil' with tailwind-merge, rely on the behavior that conflicting Tailwind classes are resolved by keeping the last one. For example, cn('base-classes bg-default', propClass) will have any conflicting background class from propClass override bg-default. This additive pattern is intentional and aligns with the shadcn-ui convention; ensure you document or review expectations accordingly in Vue components.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-12-18T02:07:38.870Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7598
File: src/components/sidebar/tabs/AssetsSidebarTab.vue:131-131
Timestamp: 2025-12-18T02:07:38.870Z
Learning: Tailwind CSS v4 safe utilities (e.g., items-center-safe, justify-*-safe, place-*-safe) are allowed in Vue components under src/ and in story files. Do not flag these specific safe variants as invalid when reviewing code in src/**/*.vue or related stories.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-12-18T21:15:46.862Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7603
File: src/components/queue/QueueOverlayHeader.vue:49-59
Timestamp: 2025-12-18T21:15:46.862Z
Learning: In the ComfyUI_frontend repository, for Vue components, do not add aria-label to buttons that have visible text content (e.g., buttons containing <span> text). The visible text provides the accessible name. Use aria-label only for elements without visible labels (e.g., icon-only buttons). If a button has no visible label, provide a clear aria-label or associate with an aria-labelledby describing its action.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
📚 Learning: 2025-12-21T01:06:02.786Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7649
File: src/components/graph/selectionToolbox/ColorPickerButton.vue:15-18
Timestamp: 2025-12-21T01:06:02.786Z
Learning: In Comfy-Org/ComfyUI_frontend, in Vue component files, when a filled icon is required (e.g., 'pi pi-circle-fill'), you may mix PrimeIcons with Lucide icons since Lucide lacks filled variants. This mixed usage is acceptable when one icon library does not provide an equivalent filled icon. Apply consistently across Vue components in the src directory where icons are used, and document the rationale when a mixed approach is chosen.
Applied to files:
src/renderer/extensions/vueNodes/components/LGraphNode.vue
🧬 Code graph analysis (1)
src/lib/litegraph/src/LGraphNode.ts (1)
src/renderer/core/layout/operations/layoutMutations.ts (1)
useLayoutMutations(67-340)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: deploy-and-comment
- GitHub Check: lint-and-format
- GitHub Check: test
- GitHub Check: collect
- GitHub Check: setup
🔇 Additional comments (14)
src/lib/litegraph/src/utils/arrange.ts (1)
140-142: LGTM!The refactor to use
setPos()instead of directposarray mutations correctly routes position updates through the centralized setter, ensuring layout mutations are emitted consistently with the rest of the codebase changes.src/renderer/extensions/vueNodes/components/LGraphNode.test.ts (2)
208-221: LGTM!The test correctly reflects the updated height calculation where
--node-height-xnow includesNODE_TITLE_HEIGHT. The added comment clearly documents the calculation logic.
223-236: LGTM!Consistent with the collapsed node test - the expanded node test correctly expects 130px to reflect the new height calculation that includes
NODE_TITLE_HEIGHT.src/lib/litegraph/src/LGraph.ts (3)
750-755: LGTM!The refactor correctly uses
setPos()while preserving the vertical/horizontal layout logic. The conditional expressions for x and y coordinates remain functionally equivalent.
1660-1665: LGTM!The position correction for title height is correctly refactored to use
setPos(). The calculation logic remains intact while ensuring layout mutations are properly emitted.
1831-1831: LGTM!Consistent with the other position update refactors - correctly uses
setPos()with the calculated offsets for unpacked subgraph node positioning.src/renderer/extensions/vueNodes/components/LGraphNode.vue (4)
138-146: LGTM!The imports are correctly organized with
onUnmountedadded for lifecycle cleanup andLayoutSourcefor type-safe source checking in the new handler.Also applies to: 164-165
312-326: LGTM!The updated height calculation correctly accounts for the title bar difference between layoutStore (which stores height without title) and CSS (which needs full visible height). The explanatory comment is valuable for future maintainers.
328-354: LGTM!The handler correctly:
- Filters for
CanvasandExternalsources to respond to extension-initiated changes- Uses early returns for irrelevant nodes, active resize operations, and collapsed state
- Applies consistent
fullHeightcalculation withinitSizeStylesThe guard conditions prevent conflicts between user interactions and external updates.
356-365: Subscription cleanup is correct and follows Vue 3 best practices.The
layoutStore.onChangemethod returns an unsubscribe function, and the code properly manages the subscription lifecycle by subscribing inonMountedand cleaning up inonUnmounted. The optional chaining safely handles the unsubscription and prevents memory leaks.src/lib/litegraph/src/LGraphCanvas.ts (2)
6220-6232: Good: usesetPos()after auto-placing a newly added node.
This keeps the “post-connect nudge” consistent with the new position synchronization approach.
2333-2346: setPos() unconditionally mutates layoutStore even in non-VueNodes clone-drag paths, and this does not appear to be guarded or intentional.The
setPos()method's pos setter (line 472–476 in LGraphNode.ts) callsuseLayoutMutations()with no vueNodesMode check. While the clone-drag code path itself is correctly guarded (!LiteGraph.vueNodesModeat line 2326), the subsequentsetPos()call bypasses this guard and triggers a Yjs transaction in layoutStore—the application's canonical CRDT-based layout store. This may be intentional (layoutStore is used application-wide), but it contradicts the mode segregation at the call site. Confirm whether layoutStore mutations in non-Vue mode are desired, or add a mode check inside the pos setter or before the setPos invocation.src/lib/litegraph/src/LGraphNode.ts (2)
479-484: LGTM!The
setPoshelper provides a cleaner API for setting position from separate x/y values, avoiding manual array construction at call sites.
2002-2014: LGTM!The
move()method correctly routes through the setter to trigger layout synchronization. ThevueNodesModeshort-circuit appropriately delegates movement handling to the Vue layout store, preventing conflicting position updates.
| for (const item of created) { | ||
| item.pos[0] += position[0] - offsetX | ||
| item.pos[1] += position[1] - offsetY | ||
| const newX = item.pos[0] + position[0] - offsetX | ||
| const newY = item.pos[1] + position[1] - offsetY | ||
| if (item instanceof LGraphNode) { | ||
| item.setPos(newX, newY) | ||
| } else { | ||
| item.pos[0] = newX | ||
| item.pos[1] = newY | ||
| } | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find and examine Reroute class definition
echo "=== Searching for Reroute class ==="
fd -t f "Reroute" src/lib/litegraph/src/
echo -e "\n=== Checking Reroute.ts for move() method ==="
rg -n "^\s*(move|setPos)\s*\(" src/lib/litegraph/src/Reroute.ts -A 5 2>/dev/null || echo "File not found or no matches"Repository: Comfy-Org/ComfyUI_frontend
Length of output: 495
🏁 Script executed:
#!/bin/bash
# Find and examine LGraphGroup class definition
echo "=== Searching for LGraphGroup class ==="
fd -t f "LGraphGroup" src/lib/litegraph/src/
echo -e "\n=== Checking LGraphGroup.ts for move() method ==="
rg -n "^\s*(move|setPos)\s*\(" src/lib/litegraph/src/LGraphGroup.ts -A 5 2>/dev/null || echo "File not found or no matches"Repository: Comfy-Org/ComfyUI_frontend
Length of output: 523
🏁 Script executed:
#!/bin/bash
# Search for layoutStore usage related to reroutes
echo "=== Searching for layoutStore and queryRerouteAtPoint ==="
rg -n "layoutStore\.|queryRerouteAtPoint|updateReroute" src/lib/litegraph/src --max-count 20
echo -e "\n=== Checking for move() implementations in all litegraph source files ==="
rg -n "^\s*move\s*\(" src/lib/litegraph/src -A 3 --max-count 30Repository: Comfy-Org/ComfyUI_frontend
Length of output: 3304
🏁 Script executed:
#!/bin/bash
# Get full Reroute.move() implementation
echo "=== Full Reroute.move() implementation ==="
sed -n '413,450p' src/lib/litegraph/src/Reroute.ts
echo -e "\n=== Full LGraphNode.move() implementation ==="
sed -n '2002,2050p' src/lib/litegraph/src/LGraphNode.ts
echo -e "\n=== Full LGraphGroup.move() implementation ==="
sed -n '227,280p' src/lib/litegraph/src/LGraphGroup.tsRepository: Comfy-Org/ComfyUI_frontend
Length of output: 4515
🏁 Script executed:
#!/bin/bash
# Check how layoutStore is updated after pos changes
echo "=== Search for updateReroute or similar in layoutStore context ==="
rg -n "updateReroute|invalidate.*[Rr]eroute|setReroutePos" src/lib/litegraph/src/
echo -e "\n=== Check Reroute setter/getter for pos ==="
rg -n "^\s*(get|set)\s+pos\|^\s*pos\s*=" src/lib/litegraph/src/Reroute.ts -A 3Repository: Comfy-Org/ComfyUI_frontend
Length of output: 383
🏁 Script executed:
#!/bin/bash
# Check the current code at lines 4013-4022 in context to see how items are used after positioning
echo "=== Context around lines 4013-4022 in LGraphCanvas.ts ==="
sed -n '4000,4050p' src/lib/litegraph/src/LGraphCanvas.tsRepository: Comfy-Org/ComfyUI_frontend
Length of output: 1616
Use item.move(dx, dy, true) for all items to ensure layout store is updated.
Direct mutation of pos[0]/pos[1] bypasses the move() method, which for Reroute calls layoutMutations.moveReroute() to sync the layout store. This leaves stale reroute layout entries that break layoutStore.queryRerouteAtPoint(...) used for hit-testing and rendering.
Proposed change (routes all items through their own movement API)
- for (const item of created) {
- const newX = item.pos[0] + position[0] - offsetX
- const newY = item.pos[1] + position[1] - offsetY
- if (item instanceof LGraphNode) {
- item.setPos(newX, newY)
- } else {
- item.pos[0] = newX
- item.pos[1] = newY
- }
- }
+ const deltaX = position[0] - offsetX
+ const deltaY = position[1] - offsetY
+ for (const item of created) {
+ item.move(deltaX, deltaY, true)
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| for (const item of created) { | |
| item.pos[0] += position[0] - offsetX | |
| item.pos[1] += position[1] - offsetY | |
| const newX = item.pos[0] + position[0] - offsetX | |
| const newY = item.pos[1] + position[1] - offsetY | |
| if (item instanceof LGraphNode) { | |
| item.setPos(newX, newY) | |
| } else { | |
| item.pos[0] = newX | |
| item.pos[1] = newY | |
| } | |
| } | |
| const deltaX = position[0] - offsetX | |
| const deltaY = position[1] - offsetY | |
| for (const item of created) { | |
| item.move(deltaX, deltaY, true) | |
| } |
🤖 Prompt for AI Agents
In @src/lib/litegraph/src/LGraphCanvas.ts around lines 4013 - 4022, The loop
currently sets positions directly (using LGraphNode.setPos(...) and direct pos
mutation) which bypasses item.move and leaves reroute layout entries stale;
replace both branches to compute dx = newX - item.pos[0], dy = newY -
item.pos[1] and call item.move(dx, dy, true) for every item (including instances
of LGraphNode and Reroute) so the movement API and layoutMutations.moveReroute()
are invoked and the layout store stays in sync.
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/lib/litegraph/src/LGraphCanvas.ts`:
- Around line 8538-8544: The applyNodePositionUpdates method currently types its
parameter inline as Array<{ node: LGraphNode; newPos: { x: number; y: number }
}>, duplicating the existing NewNodePosition type; change the signature of
applyNodePositionUpdates to accept NewNodePosition[] (or Array<NewNodePosition>)
instead, keeping the implementation (for ... of nodesToMove) the same, and
ensure NewNodePosition is in scope/imported so the compiler recognizes the type.
♻️ Duplicate comments (1)
src/lib/litegraph/src/LGraphCanvas.ts (1)
4032-4040: Update reroute positioning viamove()to keep layout store in sync.Line 4032–4040 still directly mutates
posfor non-nodes. ForReroute, this bypasses its movement API (and layoutStore updates), which can leave stale reroute layout entries after paste and break hit testing. Prefer routing reroute updates throughmove()while keeping node updates viasetPos.🛠️ Proposed fix
- for (const item of created) { - const newX = item.pos[0] + position[0] - offsetX - const newY = item.pos[1] + position[1] - offsetY - if (item instanceof LGraphNode) { - item.setPos(newX, newY) - } else { - item.pos[0] = newX - item.pos[1] = newY - } - } + const deltaX = position[0] - offsetX + const deltaY = position[1] - offsetY + for (const item of created) { + if (item instanceof LGraphNode) { + item.setPos(item.pos[0] + deltaX, item.pos[1] + deltaY) + } else if (item instanceof Reroute) { + item.move(deltaX, deltaY, true) + } else { + item.pos[0] += deltaX + item.pos[1] += deltaY + } + }
3af1d2d to
3ae735a
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/renderer/extensions/vueNodes/components/LGraphNode.vue`:
- Around line 322-332: The resize handler currently writes the raw layoutStore
height (body height) to the CSS var causing the node to render 30px short;
update the resize callback to add LiteGraph.NODE_TITLE_HEIGHT the same way
initSizeStyles() does so it sets the full height CSS variable (use
isCollapsed.value to pick the suffix like `initSizeStyles()`), e.g., compute
fullHeight = height + LiteGraph.NODE_TITLE_HEIGHT from size.value (or the resize
event height) and call
nodeContainerRef.value.style.setProperty(`--node-height${suffix}`,
`${fullHeight}px`) so the resize behavior matches handleLayoutChange() and
initSizeStyles().
- Around line 349-359: The current early return when isCollapsed.value prevents
updating the collapsed suffix CSS vars, so external size changes (e.g., setSize)
leave stale values; modify the block that checks isCollapsed.value inside the
handler that uses change.nodeIds and nodeData.id to still compute
newSize/fullHeight and call el.style.setProperty for the collapsed suffix vars
(e.g., '--node-width-x' and '--node-height-x') when isCollapsed.value is true,
and only skip updating the main '--node-width'/'--node-height' when collapsed;
keep the existing checks for layoutStore.isResizingVueNodes.value and
nodeContainerRef.value but replace the return on isCollapsed.value with updating
the "-x" vars (using size.value/newSize/fullHeight) then return.
♻️ Duplicate comments (2)
src/lib/litegraph/src/LGraphCanvas.ts (2)
4032-4040: Avoid directposmutation for non-node items (reroutes).
Directly settingposbypassesmove(), so reroute layout entries can go stale and breaklayoutStore.queryRerouteAtPoint(...). Please route all items throughmove(...).♻️ Proposed fix
- for (const item of created) { - const newX = item.pos[0] + position[0] - offsetX - const newY = item.pos[1] + position[1] - offsetY - if (item instanceof LGraphNode) { - item.setPos(newX, newY) - } else { - item.pos[0] = newX - item.pos[1] = newY - } - } + const deltaX = position[0] - offsetX + const deltaY = position[1] - offsetY + for (const item of created) { + item.move(deltaX, deltaY, true) + }
8538-8544: UseNewNodePositionfor the parameter type.
The inline{ node; newPos }type duplicatesNewNodePosition. Reuse the named type for consistency.♻️ Suggested change
- private applyNodePositionUpdates( - nodesToMove: Array<{ node: LGraphNode; newPos: { x: number; y: number } }> - ): void { + private applyNodePositionUpdates(nodesToMove: NewNodePosition[]): void { for (const { node, newPos } of nodesToMove) { // setPos automatically syncs to layout store node.setPos(newPos.x, newPos.y) } }As per coding guidelines, avoid duplicating complex inline types when a named type exists.
|
Waiting for test fixes before review. |
|
Updating Playwright Expectations |
f536e84 to
17a0c02
Compare
c44ea1b to
9f307b2
Compare
694b7e5 to
3cc4af9
Compare
44f3726 to
abe5c7b
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
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/components/LGraphNode.vue (1)
327-339: Align initial height with title-height adjustment.
handleLayoutChange()addsNODE_TITLE_HEIGHT, butinitSizeStyles()does not. This can cause a height jump between initial render and subsequent layout syncs. Use the same full-height calculation for consistency.🔧 Suggested fix
function initSizeStyles() { const el = nodeContainerRef.value const { width, height } = size.value if (!el) return const suffix = isCollapsed.value ? '-x' : '' + const fullHeight = height + LiteGraph.NODE_TITLE_HEIGHT el.style.setProperty(`--node-width${suffix}`, `${width}px`) - el.style.setProperty(`--node-height${suffix}`, `${height}px`) + el.style.setProperty(`--node-height${suffix}`, `${fullHeight}px`) }
♻️ Duplicate comments (1)
src/renderer/extensions/vueNodes/components/LGraphNode.vue (1)
345-367: Avoid stale sizes when collapsed.External size updates are ignored when collapsed, so
--node-width-x/--node-height-xcan go stale and expand to the wrong size later. Update the collapsed suffix instead of returning early.🔧 Suggested fix
- if (isCollapsed.value) return - const el = nodeContainerRef.value if (!el) return const newSize = size.value const fullHeight = newSize.height + LiteGraph.NODE_TITLE_HEIGHT - el.style.setProperty('--node-width', `${newSize.width}px`) - el.style.setProperty('--node-height', `${fullHeight}px`) + const suffix = isCollapsed.value ? '-x' : '' + el.style.setProperty(`--node-width${suffix}`, `${newSize.width}px`) + el.style.setProperty(`--node-height${suffix}`, `${fullHeight}px`)
9b5f0ef to
cda9f52
Compare
727f81a to
0172405
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/lib/litegraph/src/LGraphCanvas.ts`:
- Around line 4030-4038: The paste offset loop in LGraphCanvas.ts moves only
LGraphNode and Reroute items, so LGraphGroup instances in created remain at
original coordinates; update the loop to also handle LGraphGroup by detecting
items instanceof LGraphGroup and shifting their position the same way as nodes
(e.g., call the group's position setter like setPos(item.pos[0] + dx,
item.pos[1] + dy) or the appropriate move method on LGraphGroup) so pasted
groups are translated by dx/dy along with nodes and reroutes.
♻️ Duplicate comments (1)
src/lib/litegraph/src/LGraphCanvas.ts (1)
8530-8535: ReuseNewNodePositionfor both signatures to avoid type duplication.
This keeps the type shape consistent with other call sites.♻️ Suggested refactor
- private applyNodePositionUpdates( - nodesToMove: Array<{ node: LGraphNode; newPos: { x: number; y: number } }> - ): void { + private applyNodePositionUpdates(nodesToMove: NewNodePosition[]): void { for (const { node, newPos } of nodesToMove) { // setPos automatically syncs to layout store node.setPos(newPos.x, newPos.y) } } private moveGroupChildren( group: LGraphGroup, deltaX: number, deltaY: number, - nodesToMove: Array<{ node: LGraphNode; newPos: { x: number; y: number } }> + nodesToMove: NewNodePosition[] ): void {Also applies to: 8563-8571
| // Adjust positions - use move/setPos to ensure layout store is updated | ||
| const dx = position[0] - offsetX | ||
| const dy = position[1] - offsetY | ||
| for (const item of created) { | ||
| item.pos[0] += position[0] - offsetX | ||
| item.pos[1] += position[1] - offsetY | ||
| if (item instanceof LGraphNode) { | ||
| item.setPos(item.pos[0] + dx, item.pos[1] + dy) | ||
| } else if (item instanceof Reroute) { | ||
| item.move(dx, dy) | ||
| } |
There was a problem hiding this comment.
Pasted groups aren’t offset with the paste position.
created includes LGraphGroup, but the offset loop only moves nodes and reroutes, so pasted groups will stay at the original coordinates. Please move groups alongside nodes/reroutes.
🔧 Suggested fix
for (const item of created) {
if (item instanceof LGraphNode) {
item.setPos(item.pos[0] + dx, item.pos[1] + dy)
+ } else if (item instanceof LGraphGroup) {
+ item.move(dx, dy, true)
} else if (item instanceof Reroute) {
item.move(dx, dy)
}
}🤖 Prompt for AI Agents
In `@src/lib/litegraph/src/LGraphCanvas.ts` around lines 4030 - 4038, The paste
offset loop in LGraphCanvas.ts moves only LGraphNode and Reroute items, so
LGraphGroup instances in created remain at original coordinates; update the loop
to also handle LGraphGroup by detecting items instanceof LGraphGroup and
shifting their position the same way as nodes (e.g., call the group's position
setter like setPos(item.pos[0] + dx, item.pos[1] + dy) or the appropriate move
method on LGraphGroup) so pasted groups are translated by dx/dy along with nodes
and reroutes.
dc1880f to
4adc54f
Compare
Summary
When extensions like KJNodes call node.setSize(), the Vue component now properly updates its CSS variables to reflect the new size.
Changes:
Screenshots (if applicable)
before
https://github.com/user-attachments/assets/236a173a-e41d-485b-8c63-5c28ef1c69bf
after
https://github.com/user-attachments/assets/5fc3f7e4-35c7-40e1-81ac-38a35ee0ac1b
┆Issue is synchronized with this Notion page by Unito