Skip to content

Conversation

@christian-byrne
Copy link
Contributor

@christian-byrne christian-byrne commented Dec 13, 2025

Summary

Sometimes the saved position is super far away from any of the nodes, which causes general confusion. This PR changes the loadGraphData logic to fit-to-view in those scenarios.

Fixes #7425

┆Issue is synchronized with this Notion page by Unito

When loading a workflow with a saved viewport position (extra.ds),
check if any nodes are visible in that viewport. If not, fit view
to ensure the user can see the workflow.
@christian-byrne christian-byrne requested a review from a team as a code owner December 13, 2025 06:15
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 13, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 13, 2025

📝 Walkthrough

Walkthrough

A new utility function checks if nodes overlap a visible rectangle, enabling conditional viewport auto-fitting during graph restoration. When no nodes occupy the saved viewport, the view is automatically fitted. A test verifies the behavior with visual regression testing.

Changes

Cohort / File(s) Change Summary
Viewport auto-fit logic
src/scripts/app.ts
Added conditional viewport fitting during graph restoration via new anyItemOverlapsRect import. When restore_view is enabled and viewport is empty, automatically fits view; otherwise preserves existing behavior.
Overlap detection utility
src/utils/mathUtil.ts
Exports new function anyItemOverlapsRect performing AABB collision detection between items (with position and size) and a provided rectangle.
Viewport regression test
browser_tests/tests/viewport.spec.ts, browser_tests/assets/viewport/default-viewport-saved-offscreen.json
Adds Playwright test suite loading a saved workflow viewport, advancing render frames, and asserting screenshot matches expected output. Includes JSON asset file defining the test workflow with nodes, connections, and layout groups.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/center-on-view-on-load

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a73288 and 2647571.

⛔ Files ignored due to path filters (1)
  • browser_tests/tests/viewport.spec.ts-snapshots/viewport-fits-when-saved-offscreen-chromium-linux.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • browser_tests/assets/viewport/default-viewport-saved-offscreen.json (1 hunks)
  • browser_tests/tests/viewport.spec.ts (1 hunks)
  • src/scripts/app.ts (2 hunks)
  • src/utils/mathUtil.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx,js,jsx,vue,json}

📄 CodeRabbit inference engine (AGENTS.md)

Code style: Use 2-space indentation, single quotes, no trailing semicolons, and 80-character line width (see .prettierrc)

Files:

  • browser_tests/assets/viewport/default-viewport-saved-offscreen.json
  • src/utils/mathUtil.ts
  • browser_tests/tests/viewport.spec.ts
  • src/scripts/app.ts
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/utils/mathUtil.ts
  • src/scripts/app.ts
src/**/*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.ts: Use es-toolkit for utility functions
Use TypeScript for type safety

Minimize the surface area (exported values) of each module and composable

Files:

  • src/utils/mathUtil.ts
  • src/scripts/app.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

Files:

  • src/utils/mathUtil.ts
  • src/scripts/app.ts
src/**/*.{vue,ts,tsx}

📄 CodeRabbit inference engine (src/CLAUDE.md)

Follow Vue 3 composition API style guide

Files:

  • src/utils/mathUtil.ts
  • src/scripts/app.ts
**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,vue}: Imports must be sorted and grouped by plugin; run pnpm format before committing
Use TypeScript for type safety; never use any type - use proper TypeScript types
Never use as any type assertions; fix the underlying type issue instead
Use es-toolkit for utility functions
Write code that is expressive and self-documenting; avoid comments unless absolutely necessary; do not add or retain redundant comments
Keep functions short and functional
Minimize nesting in code (e.g., deeply nested if or for statements); apply the Arrow Anti-Pattern principle
Avoid mutable state; prefer immutability and assignment at point of declaration
Favor pure functions, especially testable ones

Files:

  • src/utils/mathUtil.ts
  • browser_tests/tests/viewport.spec.ts
  • src/scripts/app.ts
browser_tests/**/*.{e2e,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (browser_tests/CLAUDE.md)

browser_tests/**/*.{e2e,spec}.{ts,tsx,js,jsx}: Test user workflows in browser tests
Use Playwright fixtures for browser tests
Follow naming conventions for browser tests
Check assets/ directory for test data when writing tests
Prefer specific selectors in browser tests
Test across multiple viewports

Files:

  • browser_tests/tests/viewport.spec.ts
browser_tests/**/*.spec.ts

📄 CodeRabbit inference engine (AGENTS.md)

browser_tests/**/*.spec.ts: E2E test files must be named browser_tests/**/*.spec.ts and use Playwright
Follow Playwright best practices described in the official documentation for E2E tests
Do not use waitForTimeout in Playwright tests; use Locator actions and retrying assertions instead
Use tags like @mobile and @2x in Playwright tests for relevant test scenarios

Files:

  • browser_tests/tests/viewport.spec.ts
🧠 Learnings (17)
📚 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/utils/mathUtil.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/utils/mathUtil.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/utils/mathUtil.ts
  • browser_tests/tests/viewport.spec.ts
  • src/scripts/app.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/utils/mathUtil.ts
  • browser_tests/tests/viewport.spec.ts
  • src/scripts/app.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:

  • browser_tests/tests/viewport.spec.ts
📚 Learning: 2025-12-09T20:22:23.620Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-09T20:22:23.620Z
Learning: Applies to browser_tests/**/*.spec.ts : Follow Playwright best practices described in the official documentation for E2E tests

Applied to files:

  • browser_tests/tests/viewport.spec.ts
📚 Learning: 2025-12-09T20:22:23.620Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-09T20:22:23.620Z
Learning: Applies to browser_tests/**/*.spec.ts : E2E test files must be named `browser_tests/**/*.spec.ts` and use Playwright

Applied to files:

  • browser_tests/tests/viewport.spec.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} : Use Playwright fixtures for browser tests

Applied to files:

  • browser_tests/tests/viewport.spec.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 user workflows in browser tests

Applied to files:

  • browser_tests/tests/viewport.spec.ts
📚 Learning: 2025-11-24T19:48:03.270Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: tests-ui/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:48:03.270Z
Learning: Applies to tests-ui/**/*.test.{js,ts,jsx,tsx} : Write tests for new features

Applied to files:

  • browser_tests/tests/viewport.spec.ts
📚 Learning: 2025-12-09T20:22:23.620Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-09T20:22:23.620Z
Learning: Applies to browser_tests/**/*.spec.ts : Use tags like `mobile` and `2x` in Playwright tests for relevant test scenarios

Applied to files:

  • browser_tests/tests/viewport.spec.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} : Follow naming conventions for browser tests

Applied to files:

  • browser_tests/tests/viewport.spec.ts
📚 Learning: 2025-12-09T20:22:23.620Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-09T20:22:23.620Z
Learning: Applies to **/*.test.ts : Write tests for all changes, especially bug fixes to catch future regressions

Applied to files:

  • browser_tests/tests/viewport.spec.ts
📚 Learning: 2025-12-13T05:54:28.225Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7415
File: browser_tests/tests/mobileBaseline.spec.ts:17-22
Timestamp: 2025-12-13T05:54:28.225Z
Learning: In browser_tests tests for the Comfy-Org/ComfyUI_frontend repository, the `comfyPage.loadWorkflow()` method already handles all necessary synchronization and waiting. No additional `await comfyPage.nextFrame()` call is needed before taking screenshots after loading a workflow.

Applied to files:

  • browser_tests/tests/viewport.spec.ts
📚 Learning: 2025-12-13T05:34:15.488Z
Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7415
File: browser_tests/tests/mobileBaseline.spec.ts:7-15
Timestamp: 2025-12-13T05:34:15.488Z
Learning: In Playwright tests for the ComfyUI frontend, the toPass() assertion uses incremental backoff during retries. When a test may involve async operations, increasing the timeout (e.g., to 5000 ms) can be sufficient instead of aggressively extending timeouts. Apply this understanding to tests under browser_tests/tests/; if not resolved, review the toPass() backoff behavior and ensure timeouts align with expected async completion without masking issues.

Applied to files:

  • browser_tests/tests/viewport.spec.ts
📚 Learning: 2025-12-09T20:22:23.620Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-09T20:22:23.620Z
Learning: Applies to browser_tests/**/*.spec.ts : Do not use `waitForTimeout` in Playwright tests; use Locator actions and retrying assertions instead

Applied to files:

  • browser_tests/tests/viewport.spec.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/scripts/app.ts
🧬 Code graph analysis (2)
src/utils/mathUtil.ts (2)
src/lib/litegraph/src/interfaces.ts (1)
  • ReadOnlyRect (240-242)
src/lib/litegraph/src/infrastructure/Rectangle.ts (1)
  • overlaps (252-259)
src/scripts/app.ts (1)
src/utils/mathUtil.ts (1)
  • anyItemOverlapsRect (104-121)
🔇 Additional comments (6)
browser_tests/tests/viewport.spec.ts (1)

6-19: LGTM! Test correctly validates viewport auto-fit behavior.

The test properly loads the workflow, waits for rendering stabilization after the auto-fit operation, and asserts the final viewport state using a visual regression test. The use of nextFrame() calls is appropriate here since the auto-fit is scheduled via requestAnimationFrame in the implementation.

src/utils/mathUtil.ts (2)

4-5: LGTM! Clean type definition.

The Vec2 type is properly defined as a readonly tuple, ensuring immutability and type safety for 2D coordinates.


98-121: LGTM! Correct AABB overlap implementation.

The function correctly implements axis-aligned bounding box intersection tests. The logic matches the existing Rectangle.overlaps pattern and includes an early-exit optimization for performance. The use of Iterable provides flexibility for different collection types.

src/scripts/app.ts (2)

67-67: LGTM! Import is correctly placed.

The import follows project conventions and the function is properly used in the viewport restoration logic.


1226-1239: No changes needed. The implementation correctly uses computeVisibleArea which sets visible_area as a side effect (by mutating its properties at lines 118-120 in DragAndScale.ts), and accessing this.rootGraph._nodes is the established pattern throughout the codebase (used in minimap, canvas rendering, thumbnail renderer, graph traversal utilities, and workflow management). A public nodes getter exists but direct _nodes access is consistent with LiteGraph's library implementation.

browser_tests/assets/viewport/default-viewport-saved-offscreen.json (1)

1-412: LGTM! Test asset correctly simulates offscreen viewport scenario.

The workflow asset is well-structured with nodes positioned in the visible coordinate space (60-1000, 170-800) while the saved viewport offset at lines 399-401 is far away ([-666.57, -2227.89]). This correctly creates the test scenario where the restored viewport would have no visible nodes, triggering the auto-fit behavior implemented in this PR.


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

@github-actions
Copy link

github-actions bot commented Dec 13, 2025

🎨 Storybook Build Status

Build completed successfully!

⏰ Completed at: 12/13/2025, 06:17:19 AM UTC

🔗 Links


🎉 Your Storybook is ready for review!

@github-actions
Copy link

github-actions bot commented Dec 13, 2025

🎭 Playwright Test Results

Some tests failed

⏰ Completed at: 12/13/2025, 06:25:58 AM UTC

📈 Summary

  • Total Tests: 501
  • Passed: 488 ✅
  • Failed: 1 ❌
  • Flaky: 3 ⚠️
  • Skipped: 9 ⏭️

📊 Test Reports by Browser

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

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

@github-actions
Copy link

Bundle Size Report

Summary

  • Raw size: 17.1 MB baseline 17.1 MB — 🔴 +287 B
  • Gzip: 3.39 MB baseline 3.39 MB — 🟢 -221 B
  • Brotli: 2.6 MB baseline 2.6 MB — 🟢 -380 B
  • Bundles: 96 current • 97 baseline • 39 added / 40 removed

Category Glance
App Entry Points 🔴 +1.71 kB (3.25 MB) · Utilities & Hooks 🟢 -1.32 kB (1.86 kB) · Graph Workspace 🟢 -68 B (984 kB) · UI Components 🟢 -33 B (178 kB) · Vendor & Third-Party ⚪ 0 B (8.56 MB) · Other ⚪ 0 B (3.81 MB) · + 3 more

Per-category breakdown
App Entry Points — 3.25 MB (baseline 3.24 MB) • 🔴 +1.71 kB

Main entry bundles and manifests

File Before After Δ Raw Δ Gzip Δ Brotli
assets/index-BePyJSib.js (new) 3.02 MB 🔴 +3.02 MB 🔴 +627 kB 🔴 +477 kB
assets/index-QUjY-h0q.js (removed) 3.02 MB 🟢 -3.02 MB 🟢 -627 kB 🟢 -477 kB
assets/index-CPG5x8Pg.js (removed) 227 kB 🟢 -227 kB 🟢 -48.6 kB 🟢 -39.8 kB
assets/index-IV76kyg4.js (new) 227 kB 🔴 +227 kB 🔴 +48.5 kB 🔴 +39.8 kB
assets/index-BVsCfkQ_.js (new) 345 B 🔴 +345 B 🔴 +243 B 🔴 +233 B
assets/index-D4KVHQSh.js (removed) 345 B 🟢 -345 B 🟢 -248 B 🟢 -234 B

Status: 3 added / 3 removed

Graph Workspace — 984 kB (baseline 984 kB) • 🟢 -68 B

Graph editor runtime, canvas, workflow orchestration

File Before After Δ Raw Δ Gzip Δ Brotli
assets/GraphView-DOAwi4ml.js (removed) 984 kB 🟢 -984 kB 🟢 -191 kB 🟢 -145 kB
assets/GraphView-C8T1seNm.js (new) 984 kB 🔴 +984 kB 🔴 +190 kB 🔴 +145 kB

Status: 1 added / 1 removed

Views & Navigation — 6.54 kB (baseline 6.54 kB) • ⚪ 0 B

Top-level views, pages, and routed surfaces

File Before After Δ Raw Δ Gzip Δ Brotli
assets/UserSelectView-BDDXOej7.js (removed) 6.54 kB 🟢 -6.54 kB 🟢 -2.14 kB 🟢 -1.89 kB
assets/UserSelectView-CfGeqqpS.js (new) 6.54 kB 🔴 +6.54 kB 🔴 +2.14 kB 🔴 +1.89 kB

Status: 1 added / 1 removed

Panels & Settings — 298 kB (baseline 298 kB) • ⚪ 0 B

Configuration panels, inspectors, and settings screens

File Before After Δ Raw Δ Gzip Δ Brotli
assets/LegacyCreditsPanel-B44Whu7w.js (new) 21.4 kB 🔴 +21.4 kB 🔴 +5.16 kB 🔴 +4.5 kB
assets/LegacyCreditsPanel-eILaK2Wu.js (removed) 21.4 kB 🟢 -21.4 kB 🟢 -5.16 kB 🟢 -4.5 kB
assets/KeybindingPanel-BdY1_SZR.js (removed) 13.6 kB 🟢 -13.6 kB 🟢 -3.42 kB 🟢 -3.03 kB
assets/KeybindingPanel-BMVHRYVq.js (new) 13.6 kB 🔴 +13.6 kB 🔴 +3.42 kB 🔴 +3.02 kB
assets/ExtensionPanel-BolR5bGB.js (new) 10.8 kB 🔴 +10.8 kB 🔴 +2.57 kB 🔴 +2.26 kB
assets/ExtensionPanel-BtCeWm0j.js (removed) 10.8 kB 🟢 -10.8 kB 🟢 -2.57 kB 🟢 -2.26 kB
assets/AboutPanel-BUvqRaKq.js (removed) 9.16 kB 🟢 -9.16 kB 🟢 -2.46 kB 🟢 -2.21 kB
assets/AboutPanel-Cbc4wEt5.js (new) 9.16 kB 🔴 +9.16 kB 🔴 +2.46 kB 🔴 +2.21 kB
assets/ServerConfigPanel-BI0Sn_Qk.js (new) 6.56 kB 🔴 +6.56 kB 🔴 +1.83 kB 🔴 +1.63 kB
assets/ServerConfigPanel-ByUWMGBP.js (removed) 6.56 kB 🟢 -6.56 kB 🟢 -1.83 kB 🟢 -1.63 kB
assets/UserPanel-BqVLecnT.js (new) 6.23 kB 🔴 +6.23 kB 🔴 +1.72 kB 🔴 +1.51 kB
assets/UserPanel-D4UB6BDZ.js (removed) 6.23 kB 🟢 -6.23 kB 🟢 -1.72 kB 🟢 -1.51 kB
assets/settings-B_sqawkt.js 27.3 kB 27.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-BhbWhsRg.js 101 B 101 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-BlDXT7wp.js 21.7 kB 21.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-Bz8HAvJu.js 21.1 kB 21.1 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-C2vW8UNv.js 24.2 kB 24.2 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-C9vsDM17.js 25.1 kB 25.1 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-DWD49kQp.js 33.3 kB 33.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-DZE27_Iz.js 25.9 kB 25.9 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-OXaZPcZF.js 26.6 kB 26.6 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-RbkKsnDG.js 25.2 kB 25.2 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 6 added / 6 removed

UI Components — 178 kB (baseline 178 kB) • 🟢 -33 B

Reusable component library chunks

File Before After Δ Raw Δ Gzip Δ Brotli
assets/Load3D.vue_vue_type_script_setup_true_lang-BIdjyzSP.js (new) 53.7 kB 🔴 +53.7 kB 🔴 +8.49 kB 🔴 +7.29 kB
assets/Load3D.vue_vue_type_script_setup_true_lang-DizWpzh_.js (removed) 53.7 kB 🟢 -53.7 kB 🟢 -8.49 kB 🟢 -7.29 kB
assets/WidgetSelect.vue_vue_type_script_setup_true_lang-C0IJ1HVP.js (removed) 48.1 kB 🟢 -48.1 kB 🟢 -10.4 kB 🟢 -9 kB
assets/WidgetSelect.vue_vue_type_script_setup_true_lang-cU73YSwh.js (new) 48.1 kB 🔴 +48.1 kB 🔴 +10.4 kB 🔴 +9.02 kB
assets/LazyImage.vue_vue_type_script_setup_true_lang-B9tp1HMI.js (new) 48 kB 🔴 +48 kB 🔴 +10.6 kB 🔴 +9.32 kB
assets/LazyImage.vue_vue_type_script_setup_true_lang-CvGCij9A.js (removed) 48 kB 🟢 -48 kB 🟢 -10.7 kB 🟢 -9.32 kB
assets/WidgetInputNumber.vue_vue_type_script_setup_true_lang-B1Nn8xCs.js (removed) 12.9 kB 🟢 -12.9 kB 🟢 -3.37 kB 🟢 -2.97 kB
assets/WidgetInputNumber.vue_vue_type_script_setup_true_lang-BOw29sCl.js (new) 12.9 kB 🔴 +12.9 kB 🔴 +3.37 kB 🔴 +2.97 kB
assets/ComfyQueueButton-CwmgnZkm.js (removed) 8.44 kB 🟢 -8.44 kB 🟢 -2.48 kB 🟢 -2.22 kB
assets/ComfyQueueButton-DYJ0Cj7W.js (new) 8.41 kB 🔴 +8.41 kB 🔴 +2.46 kB 🔴 +2.2 kB
assets/WidgetLayoutField.vue_vue_type_script_setup_true_lang-4Ar3G79R.js (new) 2.15 kB 🔴 +2.15 kB 🔴 +898 B 🔴 +768 B
assets/WidgetLayoutField.vue_vue_type_script_setup_true_lang-C-y9wZiF.js (removed) 2.15 kB 🟢 -2.15 kB 🟢 -897 B 🟢 -766 B
assets/MediaTitle.vue_vue_type_script_setup_true_lang-DmE_tJF8.js (removed) 897 B 🟢 -897 B 🟢 -503 B 🟢 -433 B
assets/MediaTitle.vue_vue_type_script_setup_true_lang-J6aWCcrn.js (new) 897 B 🔴 +897 B 🔴 +501 B 🔴 +429 B
assets/UserAvatar.vue_vue_type_script_setup_true_lang-Bjfb_hoW.js 1.34 kB 1.34 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/WidgetButton-Bm2lwPFd.js 2.04 kB 2.04 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 7 added / 7 removed

Data & Services — 12.5 kB (baseline 12.5 kB) • ⚪ 0 B

Stores, services, APIs, and repositories

File Before After Δ Raw Δ Gzip Δ Brotli
assets/keybindingService-BdJ5tXOA.js (removed) 7.51 kB 🟢 -7.51 kB 🟢 -1.83 kB 🟢 -1.58 kB
assets/keybindingService-CepyDshN.js (new) 7.51 kB 🔴 +7.51 kB 🔴 +1.83 kB 🔴 +1.58 kB
assets/audioService-BadFeRLr.js (new) 2.2 kB 🔴 +2.2 kB 🔴 +959 B 🔴 +820 B
assets/audioService-GCjOuHd7.js (removed) 2.2 kB 🟢 -2.2 kB 🟢 -964 B 🟢 -824 B
assets/serverConfigStore-BP9UaJXd.js 2.83 kB 2.83 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 2 added / 2 removed

Utilities & Hooks — 1.86 kB (baseline 3.18 kB) • 🟢 -1.32 kB

Helpers, composables, and utility bundles

File Before After Δ Raw Δ Gzip Δ Brotli
assets/audioUtils-BPF-hbRM.js (removed) 1.41 kB 🟢 -1.41 kB 🟢 -652 B 🟢 -550 B
assets/audioUtils-sMsry5Uv.js (new) 1.41 kB 🔴 +1.41 kB 🔴 +649 B 🔴 +546 B
assets/mathUtil-CD4DsosH.js (removed) 1.32 kB 🟢 -1.32 kB 🟢 -610 B 🟢 -522 B
assets/nodeFilterUtil-CXKCRJ-m.js 460 B 460 B ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 1 added / 2 removed

Vendor & Third-Party — 8.56 MB (baseline 8.56 MB) • ⚪ 0 B

External libraries and shared vendor chunks

File Before After Δ Raw Δ Gzip Δ Brotli
assets/vendor-chart-W_3Knk2t.js 452 kB 452 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-other-BzuNIfYH.js 3.98 MB 3.98 MB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-primevue-CmhMHYBF.js 1.96 MB 1.96 MB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-three-aR6ntw5X.js 1.37 MB 1.37 MB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-tiptap-DCLYW5rb.js 232 kB 232 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-vue-C3MDzIsc.js 160 kB 160 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-xterm-BZLod3g9.js 407 kB 407 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
Other — 3.81 MB (baseline 3.81 MB) • ⚪ 0 B

Bundles that do not match a named category

File Before After Δ Raw Δ Gzip Δ Brotli
assets/WidgetRecordAudio-C-oR4OCI.js (new) 20.4 kB 🔴 +20.4 kB 🔴 +5.23 kB 🔴 +4.63 kB
assets/WidgetRecordAudio-CQGSb-FO.js (removed) 20.4 kB 🟢 -20.4 kB 🟢 -5.24 kB 🟢 -4.63 kB
assets/AudioPreviewPlayer-BiX5dCdB.js (new) 13.4 kB 🔴 +13.4 kB 🔴 +3.37 kB 🔴 +3.01 kB
assets/AudioPreviewPlayer-Ci7ulI5i.js (removed) 13.4 kB 🟢 -13.4 kB 🟢 -3.37 kB 🟢 -3.01 kB
assets/WidgetGalleria-mzi1lXMv.js (removed) 4.1 kB 🟢 -4.1 kB 🟢 -1.45 kB 🟢 -1.3 kB
assets/WidgetGalleria-NwVgAMj3.js (new) 4.1 kB 🔴 +4.1 kB 🔴 +1.44 kB 🔴 +1.31 kB
assets/WidgetColorPicker-CsOVCrbU.js (removed) 3.41 kB 🟢 -3.41 kB 🟢 -1.38 kB 🟢 -1.23 kB
assets/WidgetColorPicker-DJtpCLjT.js (new) 3.41 kB 🔴 +3.41 kB 🔴 +1.38 kB 🔴 +1.23 kB
assets/WidgetTextarea-A6qFAQ1n.js (new) 3.08 kB 🔴 +3.08 kB 🔴 +1.21 kB 🔴 +1.08 kB
assets/WidgetTextarea-CgbGYmRm.js (removed) 3.08 kB 🟢 -3.08 kB 🟢 -1.22 kB 🟢 -1.08 kB
assets/WidgetMarkdown-BMX6e0t9.js (removed) 3.08 kB 🟢 -3.08 kB 🟢 -1.28 kB 🟢 -1.12 kB
assets/WidgetMarkdown-Cvizoh02.js (new) 3.08 kB 🔴 +3.08 kB 🔴 +1.28 kB 🔴 +1.13 kB
assets/WidgetAudioUI-CpkSuduw.js (new) 2.86 kB 🔴 +2.86 kB 🔴 +1.16 kB 🔴 +1.05 kB
assets/WidgetAudioUI-ilGit87F.js (removed) 2.86 kB 🟢 -2.86 kB 🟢 -1.16 kB 🟢 -1.05 kB
assets/WidgetInputText-BM4Feh8t.js (new) 1.99 kB 🔴 +1.99 kB 🔴 +918 B 🔴 +844 B
assets/WidgetInputText-ibYUl84s.js (removed) 1.99 kB 🟢 -1.99 kB 🟢 -919 B 🟢 -851 B
assets/WidgetToggleSwitch-Ctk9AVsK.js (removed) 1.76 kB 🟢 -1.76 kB 🟢 -834 B 🟢 -732 B
assets/WidgetToggleSwitch-sGrDnYL0.js (new) 1.76 kB 🔴 +1.76 kB 🔴 +834 B 🔴 +732 B
assets/MediaImageBottom-3FvHUH3-.js (new) 1.55 kB 🔴 +1.55 kB 🔴 +735 B 🔴 +642 B
assets/MediaImageBottom-DBMRQyi0.js (removed) 1.55 kB 🟢 -1.55 kB 🟢 -736 B 🟢 -638 B
assets/MediaAudioBottom-DHkBaLYf.js (new) 1.51 kB 🔴 +1.51 kB 🔴 +734 B 🔴 +655 B
assets/MediaAudioBottom-dijvQ1XT.js (removed) 1.51 kB 🟢 -1.51 kB 🟢 -735 B 🟢 -651 B
assets/Media3DBottom-DnsoGJHw.js (new) 1.5 kB 🔴 +1.5 kB 🔴 +732 B 🔴 +652 B
assets/Media3DBottom-jluc0qW_.js (removed) 1.5 kB 🟢 -1.5 kB 🟢 -736 B 🟢 -652 B
assets/MediaVideoBottom-BHCot78P.js (new) 1.5 kB 🔴 +1.5 kB 🔴 +733 B 🔴 +650 B
assets/MediaVideoBottom-CE3CxNzk.js (removed) 1.5 kB 🟢 -1.5 kB 🟢 -735 B 🟢 -652 B
assets/Media3DTop-CgtdcfQ3.js (new) 1.49 kB 🔴 +1.49 kB 🔴 +761 B 🔴 +655 B
assets/Media3DTop-D-guMXvU.js (removed) 1.49 kB 🟢 -1.49 kB 🟢 -765 B 🟢 -652 B
assets/WidgetSelect-CCIwbHf9.js (new) 655 B 🔴 +655 B 🔴 +341 B 🔴 +290 B
assets/WidgetSelect-CQB535AH.js (removed) 655 B 🟢 -655 B 🟢 -342 B 🟢 -288 B
assets/WidgetInputNumber-7-PPUvHR.js (removed) 595 B 🟢 -595 B 🟢 -331 B 🟢 -276 B
assets/WidgetInputNumber-DydNJ3WY.js (new) 595 B 🔴 +595 B 🔴 +329 B 🔴 +276 B
assets/Load3D-Csft3Zk_.js (removed) 424 B 🟢 -424 B 🟢 -265 B 🟢 -222 B
assets/Load3D-KnWvlfQi.js (new) 424 B 🔴 +424 B 🔴 +266 B 🔴 +225 B
assets/WidgetLegacy-BIJ5sCVa.js (removed) 364 B 🟢 -364 B 🟢 -236 B 🟢 -193 B
assets/WidgetLegacy-Du-RlvYc.js (new) 364 B 🔴 +364 B 🔴 +235 B 🔴 +224 B
assets/commands-_s-RvhJR.js 13.6 kB 13.6 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-BuUILW6P.js 13 kB 13 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-BV4R6fLx.js 14.9 kB 14.9 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-BWp4HdfU.js 101 B 101 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-CLwPdnT6.js 14.2 kB 14.2 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-CWMchBmd.js 15.9 kB 15.9 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-DazTQhtc.js 12.9 kB 12.9 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-DmWrOe93.js 13.7 kB 13.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-DwiH7Kr6.js 13.8 kB 13.8 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/commands-mS3LCNPn.js 14.5 kB 14.5 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-BMi-Aksj.js 99 kB 99 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-CqR8skJT.js 73.1 kB 73.1 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-Cw9RZWRY.js 89 B 89 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-DcRHAFEy.js 81.7 kB 81.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-DdFdLxku.js 72.2 kB 72.2 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-DJAtuVu5.js 84.3 kB 84.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-DK8I9Rk3.js 114 kB 114 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-gP_ssnMb.js 83.4 kB 83.4 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-nxXY9vGp.js 94 kB 94 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-Ycd3gqkA.js 86.5 kB 86.5 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/MediaAudioTop-taU5Yj_Q.js 1.46 kB 1.46 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/MediaImageTop-BoT3yC-l.js 1.75 kB 1.75 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/MediaVideoTop-Csf8f_9c.js 2.65 kB 2.65 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-_qLI3Y-X.js 317 kB 317 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-BoBMp_wf.js 307 kB 307 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-Bw_Jitw_.js 101 B 101 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-Ce9u3PlO.js 342 kB 342 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-CgjGEDDp.js 285 kB 285 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-CL3A8ieS.js 306 kB 306 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-DNUc-sw4.js 303 kB 303 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-DxUbhTnC.js 282 kB 282 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-i8mv_3Jj.js 369 kB 369 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-wCFicyab.js 310 kB 310 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/WidgetChart-CWEwKtMY.js 2.48 kB 2.48 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/WidgetImageCompare-DSf2ZEwg.js 2.21 kB 2.21 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/widgetPropFilter-BIbGSUAt.js 1.28 kB 1.28 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 18 added / 18 removed

@christian-byrne christian-byrne added the New Browser Test Expectations New browser test screenshot should be set by github action label Dec 13, 2025
@github-actions
Copy link

Updating Playwright Expectations

@github-actions github-actions bot removed the New Browser Test Expectations New browser test screenshot should be set by github action label Dec 13, 2025
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This workflow's viewport data is way down to the right with no nodes in view. This snapshot verified the fit-to-view happened automatically.

Copy link
Collaborator

@AustinMroz AustinMroz left a comment

Choose a reason for hiding this comment

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

I'm assuming canvas.computeVisibleNodes isn't used because node.boundingRect isn't initialized yet?

I suppose that creates an edge case where a single node title barely displaying off the bottom of the screen will still trigger fit, but that's not worth solving.

LGTM

@christian-byrne christian-byrne merged commit 1d014c0 into main Dec 17, 2025
3 checks passed
@christian-byrne christian-byrne deleted the feat/center-on-view-on-load branch December 17, 2025 23:38
Enferlain pushed a commit to Enferlain/ComfyUI_frontend that referenced this pull request Dec 18, 2025
…fit to view (Comfy-Org#7435)

## Summary

Sometimes the saved position is super far away from any of the nodes,
which causes general confusion. This PR changes the `loadGraphData`
logic to fit-to-view in those scenarios.

Fixes Comfy-Org#7425

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7435-feat-when-restored-position-has-no-nodes-in-viewport-automatically-fit-to-view-2c86d73d36508119bf2ed9d361ec868f)
by [Unito](https://www.unito.io)

---------

Co-authored-by: github-actions <github-actions@github.com>
christian-byrne pushed a commit that referenced this pull request Dec 24, 2025
#7435 introduced a tricky regression which will cause extremely small
levels of zoom with nodes spread far apart when in vue mode. I am able
to consistently reproduce this behaviour by
- Being in vue mode
- Swapping to a different tab so that ComfyUI is in the background
- Making a pointless line change to frontend code so that vite forces a
reload
- Waiting ~1 minute to ensure the reload completes
- Swapping back to the ComfyUI tab

From testing, if a reload occurs while the tab is backgrounded, the
canvas has an uninitialized size of 300x150. This PR proposes falling
back to a more sane default width and height of 1920x1080 if it is
detected that the canvas element is unitialized.

| Before | After |
| ------ | ----- |
| <img width="360" alt="before"
src="https://github.com/user-attachments/assets/8e19fc98-7187-4008-98cc-fb5ea3bcdce2"/>
| <img width="360" alt="after"
src="https://github.com/user-attachments/assets/add88614-3451-44df-ae9a-b0b867486459"
/>|

This appears to have consistently good results, but second opinions or
further testing would be appreciated. A more reasonable option (like
skipping this automatic fitView if the canvas has uninitialized size) is
likely to be safer, even if it results in a return of edge cases
resulting in a graph having no nodes in view after load.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7751-Workaround-for-reload-causing-node-spread-2d36d73d365081b9ae74d5f0e6f436f5)
by [Unito](https://www.unito.io)
Yourz pushed a commit that referenced this pull request Dec 24, 2025
…fit to view (#7435)

## Summary

Sometimes the saved position is super far away from any of the nodes,
which causes general confusion. This PR changes the `loadGraphData`
logic to fit-to-view in those scenarios.

Fixes #7425

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7435-feat-when-restored-position-has-no-nodes-in-viewport-automatically-fit-to-view-2c86d73d36508119bf2ed9d361ec868f)
by [Unito](https://www.unito.io)

---------

Co-authored-by: github-actions <github-actions@github.com>
Yourz pushed a commit that referenced this pull request Dec 24, 2025
#7435 introduced a tricky regression which will cause extremely small
levels of zoom with nodes spread far apart when in vue mode. I am able
to consistently reproduce this behaviour by
- Being in vue mode
- Swapping to a different tab so that ComfyUI is in the background
- Making a pointless line change to frontend code so that vite forces a
reload
- Waiting ~1 minute to ensure the reload completes
- Swapping back to the ComfyUI tab

From testing, if a reload occurs while the tab is backgrounded, the
canvas has an uninitialized size of 300x150. This PR proposes falling
back to a more sane default width and height of 1920x1080 if it is
detected that the canvas element is unitialized.

| Before | After |
| ------ | ----- |
| <img width="360" alt="before"
src="https://github.com/user-attachments/assets/8e19fc98-7187-4008-98cc-fb5ea3bcdce2"/>
| <img width="360" alt="after"
src="https://github.com/user-attachments/assets/add88614-3451-44df-ae9a-b0b867486459"
/>|

This appears to have consistently good results, but second opinions or
further testing would be appreciated. A more reasonable option (like
skipping this automatic fitView if the canvas has uninitialized size) is
likely to be safer, even if it results in a return of edge cases
resulting in a graph having no nodes in view after load.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7751-Workaround-for-reload-causing-node-spread-2d36d73d365081b9ae74d5f0e6f436f5)
by [Unito](https://www.unito.io)
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.

New templates do not fit into view

3 participants