Skip to content

Conversation

@AustinMroz
Copy link
Collaborator

@AustinMroz AustinMroz commented Dec 6, 2025

Previously the color of a link would simply use the type of the target slot and fallback to the type of the origin slot. When a connection is made to a node that accepts the any type ('*'), the link has the green color of an unknown type.

Instead, when a connection is made, the type of a link is now calculated as the greatest common type of the source and destination. This means that connections to reroutes are correctly colored.

Before After
before after

The code for calculating common types already exists, it has simply been moved into litegraph and given a more descriptive name.

Resolves #7196

┆Issue is synchronized with this Notion page by Unito

@AustinMroz AustinMroz requested a review from a team as a code owner December 6, 2025 19:08
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 6, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 6, 2025

📝 Walkthrough

Walkthrough

Replaces local type-combination helpers with a new exported commonType utility, updates dynamic widget and LGraphNode slot type computations to use commonType, and removes the historical combineTypes/intersection implementations and the isStrings type guard.

Changes

Cohort / File(s) Summary
Type utility added & guards removed
src/lib/litegraph/src/utils/type.ts, src/utils/typeGuardUtil.ts
Adds exported `commonType(...types: ISlotType[]): ISlotType
Dynamic widget type matching updates
src/core/graph/widgets/dynamicWidgets.ts
Replaces local combineTypes/intersection usage with commonType when computing input-slot combined types and output-slot types; updates imports to import commonType and removes imports of without and the removed isStrings.
Graph node slot type inference updates
src/lib/litegraph/src/LGraphNode.ts
Uses commonType to compute maybeCommonType for link type selection (prefer shared concrete type when available) in link creation and connectSlots; updates imports accordingly.

Possibly related PRs

  • Add support for growable inputs #6830: Replaces earlier combineTypes/isStrings/intersection helpers and updates dynamic widget and node slot-type combination usage to the new commonType utility.

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implementation directly addresses issue #7196 by computing link types as the greatest common type of source and destination slots, ensuring reroute nodes and wires inherit the correct upstream output color instead of displaying the incorrect 'unknown' green color.
Out of Scope Changes check ✅ Passed All changes are focused on implementing common type calculation and applying it to link color determination, directly supporting the PR objective of fixing reroute node coloring without introducing unrelated modifications.
✨ 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 austin/common-link-type

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

❤️ Share

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

@github-actions
Copy link

github-actions bot commented Dec 6, 2025

🎨 Storybook Build Status

Build completed successfully!

⏰ Completed at: 12/06/2025, 07:50:39 PM UTC

🔗 Links


🎉 Your Storybook is ready for review!

@github-actions
Copy link

github-actions bot commented Dec 6, 2025

🎭 Playwright Test Results

⚠️ Tests passed with flaky tests

⏰ Completed at: 12/06/2025, 07:59:23 PM UTC

📈 Summary

  • Total Tests: 494
  • Passed: 479 ✅
  • Failed: 0
  • Flaky: 5 ⚠️
  • Skipped: 10 ⏭️

📊 Test Reports by Browser

  • chromium: View Report • ✅ 470 / ❌ 0 / ⚠️ 5 / ⏭️ 10
  • 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

github-actions bot commented Dec 6, 2025

Bundle Size Report

Summary

  • Raw size: 17 MB baseline 17 MB — 🔴 +104 B
  • Gzip: 3.38 MB baseline 3.38 MB — 🟢 -47 B
  • Brotli: 2.59 MB baseline 2.59 MB — 🔴 +78 B
  • Bundles: 97 current • 97 baseline • 52 added / 52 removed

Category Glance
App Entry Points 🔴 +104 B (3.2 MB) · Vendor & Third-Party ⚪ 0 B (8.56 MB) · Other ⚪ 0 B (3.81 MB) · Graph Workspace ⚪ 0 B (976 kB) · Panels & Settings ⚪ 0 B (298 kB) · UI Components ⚪ 0 B (177 kB) · + 3 more

Per-category breakdown
App Entry Points — 3.2 MB (baseline 3.2 MB) • 🔴 +104 B

Main entry bundles and manifests

File Before After Δ Raw Δ Gzip Δ Brotli
assets/index-D2r04oM8.js (new) 2.97 MB 🔴 +2.97 MB 🔴 +619 kB 🔴 +470 kB
assets/index-p6HHIzLG.js (removed) 2.97 MB 🟢 -2.97 MB 🟢 -619 kB 🟢 -470 kB
assets/index-Cfi8WlbO.js (new) 223 kB 🔴 +223 kB 🔴 +47.6 kB 🔴 +39.3 kB
assets/index-CWnC8JMu.js (removed) 223 kB 🟢 -223 kB 🟢 -47.6 kB 🟢 -39.3 kB
assets/index-Beh8vXZq.js (new) 345 B 🔴 +345 B 🔴 +246 B 🔴 +238 B
assets/index-DXLa2ESP.js (removed) 345 B 🟢 -345 B 🟢 -247 B 🟢 -235 B

Status: 3 added / 3 removed

Graph Workspace — 976 kB (baseline 976 kB) • ⚪ 0 B

Graph editor runtime, canvas, workflow orchestration

File Before After Δ Raw Δ Gzip Δ Brotli
assets/GraphView-hEDOjsAs.js (new) 976 kB 🔴 +976 kB 🔴 +189 kB 🔴 +144 kB
assets/GraphView-R_HLnxmt.js (removed) 976 kB 🟢 -976 kB 🟢 -189 kB 🟢 -144 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-a56WY3D_.js (new) 6.54 kB 🔴 +6.54 kB 🔴 +2.14 kB 🔴 +1.9 kB
assets/UserSelectView-DbQkMsO0.js (removed) 6.54 kB 🟢 -6.54 kB 🟢 -2.14 kB 🟢 -1.9 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/CreditsPanel-BY_hddnv.js (new) 21.4 kB 🔴 +21.4 kB 🔴 +5.15 kB 🔴 +4.5 kB
assets/CreditsPanel-CiAqbDgq.js (removed) 21.4 kB 🟢 -21.4 kB 🟢 -5.15 kB 🟢 -4.5 kB
assets/KeybindingPanel-BHnE4zHO.js (removed) 13.6 kB 🟢 -13.6 kB 🟢 -3.42 kB 🟢 -3.02 kB
assets/KeybindingPanel-Dnm8yKU5.js (new) 13.6 kB 🔴 +13.6 kB 🔴 +3.42 kB 🔴 +3.01 kB
assets/ExtensionPanel-ChTzn4N1.js (removed) 10.8 kB 🟢 -10.8 kB 🟢 -2.58 kB 🟢 -2.26 kB
assets/ExtensionPanel-tcruOkTh.js (new) 10.8 kB 🔴 +10.8 kB 🔴 +2.57 kB 🔴 +2.26 kB
assets/AboutPanel-BSHLoP86.js (removed) 9.16 kB 🟢 -9.16 kB 🟢 -2.46 kB 🟢 -2.21 kB
assets/AboutPanel-CaipNbLl.js (new) 9.16 kB 🔴 +9.16 kB 🔴 +2.46 kB 🔴 +2.21 kB
assets/ServerConfigPanel-B5ikDPpq.js (removed) 6.56 kB 🟢 -6.56 kB 🟢 -1.83 kB 🟢 -1.63 kB
assets/ServerConfigPanel-mL998WQR.js (new) 6.56 kB 🔴 +6.56 kB 🔴 +1.83 kB 🔴 +1.63 kB
assets/UserPanel-B2E1GkyQ.js (new) 6.23 kB 🔴 +6.23 kB 🔴 +1.72 kB 🔴 +1.5 kB
assets/UserPanel-CM_P4-j5.js (removed) 6.23 kB 🟢 -6.23 kB 🟢 -1.72 kB 🟢 -1.51 kB
assets/settings-BhbWhsRg.js 101 B 101 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-BXTtSH4O.js 33.3 kB 33.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-C9Pzn-NG.js 25.2 kB 25.2 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-CCy2fA_h.js 27.3 kB 27.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-CQpqEFfl.js 26.6 kB 26.6 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-DHcnxypw.js 21.7 kB 21.7 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-DhFTK9fY.js 25.1 kB 25.1 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-DlT4t_ui.js 25.9 kB 25.9 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-DRgSrIdD.js 24.2 kB 24.2 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/settings-tjkeqiZq.js 21.1 kB 21.1 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 6 added / 6 removed

UI Components — 177 kB (baseline 177 kB) • ⚪ 0 B

Reusable component library chunks

File Before After Δ Raw Δ Gzip Δ Brotli
assets/Load3D.vue_vue_type_script_setup_true_lang-C7dIH-eZ.js (new) 53.9 kB 🔴 +53.9 kB 🔴 +8.52 kB 🔴 +7.32 kB
assets/Load3D.vue_vue_type_script_setup_true_lang-CVrzZWE9.js (removed) 53.9 kB 🟢 -53.9 kB 🟢 -8.52 kB 🟢 -7.32 kB
assets/WidgetSelect.vue_vue_type_script_setup_true_lang-BthxNI8v.js (removed) 47.9 kB 🟢 -47.9 kB 🟢 -10.3 kB 🟢 -8.98 kB
assets/WidgetSelect.vue_vue_type_script_setup_true_lang-C1qVVSIe.js (new) 47.9 kB 🔴 +47.9 kB 🔴 +10.3 kB 🔴 +8.96 kB
assets/LazyImage.vue_vue_type_script_setup_true_lang-C9BPqWoN.js (removed) 46.9 kB 🟢 -46.9 kB 🟢 -10.5 kB 🟢 -9.19 kB
assets/LazyImage.vue_vue_type_script_setup_true_lang-De24rZrm.js (new) 46.9 kB 🔴 +46.9 kB 🔴 +10.5 kB 🔴 +9.18 kB
assets/WidgetInputNumber.vue_vue_type_script_setup_true_lang-CzQsBhfm.js (new) 12.9 kB 🔴 +12.9 kB 🔴 +3.37 kB 🔴 +2.97 kB
assets/WidgetInputNumber.vue_vue_type_script_setup_true_lang-rkpP3Iuq.js (removed) 12.9 kB 🟢 -12.9 kB 🟢 -3.37 kB 🟢 -2.99 kB
assets/ComfyQueueButton-C2UXpGgI.js (removed) 8.44 kB 🟢 -8.44 kB 🟢 -2.48 kB 🟢 -2.21 kB
assets/ComfyQueueButton-DctpNn9R.js (new) 8.44 kB 🔴 +8.44 kB 🔴 +2.48 kB 🔴 +2.21 kB
assets/WidgetLayoutField.vue_vue_type_script_setup_true_lang-6ZIklFyS.js (new) 2.26 kB 🔴 +2.26 kB 🔴 +878 B 🔴 +757 B
assets/WidgetLayoutField.vue_vue_type_script_setup_true_lang-OWi66h7l.js (removed) 2.26 kB 🟢 -2.26 kB 🟢 -878 B 🟢 -762 B
assets/WidgetButton-BxCujTML.js (removed) 2.04 kB 🟢 -2.04 kB 🟢 -930 B 🟢 -811 B
assets/WidgetButton-CFWrwaAG.js (new) 2.04 kB 🔴 +2.04 kB 🔴 +926 B 🔴 +812 B
assets/UserAvatar.vue_vue_type_script_setup_true_lang-BPGmgVoN.js (new) 1.34 kB 🔴 +1.34 kB 🔴 +687 B 🔴 +596 B
assets/UserAvatar.vue_vue_type_script_setup_true_lang-BRkyALVq.js (removed) 1.34 kB 🟢 -1.34 kB 🟢 -686 B 🟢 -592 B
assets/MediaTitle.vue_vue_type_script_setup_true_lang-CPa1Pnz-.js (new) 897 B 🔴 +897 B 🔴 +504 B 🔴 +465 B
assets/MediaTitle.vue_vue_type_script_setup_true_lang-DZkRhkaF.js (removed) 897 B 🟢 -897 B 🟢 -504 B 🟢 -439 B

Status: 9 added / 9 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-5L9cCtin.js (new) 7.51 kB 🔴 +7.51 kB 🔴 +1.84 kB 🔴 +1.58 kB
assets/keybindingService-rFZi8WXM.js (removed) 7.51 kB 🟢 -7.51 kB 🟢 -1.84 kB 🟢 -1.58 kB
assets/serverConfigStore-DoucbuhB.js (removed) 2.83 kB 🟢 -2.83 kB 🟢 -907 B 🟢 -795 B
assets/serverConfigStore-L3qzi_1Z.js (new) 2.83 kB 🔴 +2.83 kB 🔴 +909 B 🔴 +791 B
assets/audioService-CVF_sh14.js (new) 2.2 kB 🔴 +2.2 kB 🔴 +962 B 🔴 +830 B
assets/audioService-DNvnrr2q.js (removed) 2.2 kB 🟢 -2.2 kB 🟢 -962 B 🟢 -818 B

Status: 3 added / 3 removed

Utilities & Hooks — 2.94 kB (baseline 2.94 kB) • ⚪ 0 B

Helpers, composables, and utility bundles

File Before After Δ Raw Δ Gzip Δ Brotli
assets/audioUtils-BJ0ah7pg.js (removed) 1.41 kB 🟢 -1.41 kB 🟢 -651 B 🟢 -542 B
assets/audioUtils-J8pOWkVG.js (new) 1.41 kB 🔴 +1.41 kB 🔴 +652 B 🔴 +549 B
assets/mathUtil-CTARWQ-l.js 1.07 kB 1.07 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeFilterUtil-CXKCRJ-m.js 460 B 460 B ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 1 added / 1 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-other-BZV8aGUB.js (new) 3.98 MB 🔴 +3.98 MB 🔴 +843 kB 🔴 +673 kB
assets/vendor-other-CtZJbx9q.js (removed) 3.98 MB 🟢 -3.98 MB 🟢 -843 kB 🟢 -673 kB
assets/vendor-primevue-BeMfDZy5.js (removed) 1.96 MB 🟢 -1.96 MB 🟢 -336 kB 🟢 -202 kB
assets/vendor-primevue-DUTcKlCc.js (new) 1.96 MB 🔴 +1.96 MB 🔴 +336 kB 🔴 +202 kB
assets/vendor-chart-AOHFmsOW.js (removed) 452 kB 🟢 -452 kB 🟢 -99.1 kB 🟢 -81 kB
assets/vendor-chart-DJFoH6N_.js (new) 452 kB 🔴 +452 kB 🔴 +99.1 kB 🔴 +81 kB
assets/vendor-tiptap-Cmu0_BY4.js (new) 232 kB 🔴 +232 kB 🔴 +45.7 kB 🔴 +37.7 kB
assets/vendor-tiptap-CZ8p6YbU.js (removed) 232 kB 🟢 -232 kB 🟢 -45.7 kB 🟢 -37.7 kB
assets/vendor-vue-Bz22sFex.js (new) 160 kB 🔴 +160 kB 🔴 +37.3 kB 🔴 +31.6 kB
assets/vendor-vue-CM5juDXV.js (removed) 160 kB 🟢 -160 kB 🟢 -37.3 kB 🟢 -31.6 kB
assets/vendor-three-aR6ntw5X.js 1.37 MB 1.37 MB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/vendor-xterm-BZLod3g9.js 407 kB 407 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 5 added / 5 removed

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-BKbLLGSZ.js (new) 20.4 kB 🔴 +20.4 kB 🔴 +5.24 kB 🔴 +4.63 kB
assets/WidgetRecordAudio-DHcshv7c.js (removed) 20.4 kB 🟢 -20.4 kB 🟢 -5.24 kB 🟢 -4.63 kB
assets/AudioPreviewPlayer-BRmWcXGY.js (removed) 13.5 kB 🟢 -13.5 kB 🟢 -3.4 kB 🟢 -3.04 kB
assets/AudioPreviewPlayer-CkPiG0qT.js (new) 13.5 kB 🔴 +13.5 kB 🔴 +3.4 kB 🔴 +3.04 kB
assets/WidgetGalleria-BJCmzv1d.js (new) 4.1 kB 🔴 +4.1 kB 🔴 +1.45 kB 🔴 +1.3 kB
assets/WidgetGalleria-cTIiEkcg.js (removed) 4.1 kB 🟢 -4.1 kB 🟢 -1.45 kB 🟢 -1.3 kB
assets/WidgetColorPicker-BrEu9BJt.js (new) 3.41 kB 🔴 +3.41 kB 🔴 +1.38 kB 🔴 +1.23 kB
assets/WidgetColorPicker-BrP689o9.js (removed) 3.41 kB 🟢 -3.41 kB 🟢 -1.38 kB 🟢 -1.23 kB
assets/WidgetMarkdown-B4m7Qpvz.js (new) 3.08 kB 🔴 +3.08 kB 🔴 +1.28 kB 🔴 +1.12 kB
assets/WidgetMarkdown-DCXXxNFV.js (removed) 3.08 kB 🟢 -3.08 kB 🟢 -1.28 kB 🟢 -1.12 kB
assets/WidgetTextarea-BVdrczKn.js (removed) 2.93 kB 🟢 -2.93 kB 🟢 -1.17 kB 🟢 -1.04 kB
assets/WidgetTextarea-CG-ClsO1.js (new) 2.93 kB 🔴 +2.93 kB 🔴 +1.17 kB 🔴 +1.04 kB
assets/WidgetAudioUI-B1glrefB.js (new) 2.85 kB 🔴 +2.85 kB 🔴 +1.16 kB 🔴 +1.06 kB
assets/WidgetAudioUI-DwPCM-xn.js (removed) 2.85 kB 🟢 -2.85 kB 🟢 -1.17 kB 🟢 -1.06 kB
assets/MediaVideoTop-ehTZdDBw.js (new) 2.76 kB 🔴 +2.76 kB 🔴 +1.05 kB 🔴 +901 B
assets/MediaVideoTop-hmtA3SJn.js (removed) 2.76 kB 🟢 -2.76 kB 🟢 -1.05 kB 🟢 -901 B
assets/WidgetChart-j6EYUdOM.js (new) 2.48 kB 🔴 +2.48 kB 🔴 +932 B 🔴 +819 B
assets/WidgetChart-wbQtTR0r.js (removed) 2.48 kB 🟢 -2.48 kB 🟢 -932 B 🟢 -815 B
assets/WidgetImageCompare-D5bj5c8l.js (new) 2.21 kB 🔴 +2.21 kB 🔴 +748 B 🔴 +659 B
assets/WidgetImageCompare-LIXuaXNa.js (removed) 2.21 kB 🟢 -2.21 kB 🟢 -748 B 🟢 -661 B
assets/WidgetInputText-CnTDmNwj.js (removed) 1.99 kB 🟢 -1.99 kB 🟢 -920 B 🟢 -849 B
assets/WidgetInputText-DL2mFo2W.js (new) 1.99 kB 🔴 +1.99 kB 🔴 +916 B 🔴 +829 B
assets/MediaImageTop-BtY1hGDO.js (new) 1.75 kB 🔴 +1.75 kB 🔴 +843 B 🔴 +718 B
assets/MediaImageTop-Dfil_e4_.js (removed) 1.75 kB 🟢 -1.75 kB 🟢 -841 B 🟢 -714 B
assets/WidgetToggleSwitch-DOfuzDiX.js (removed) 1.58 kB 🟢 -1.58 kB 🟢 -761 B 🟢 -672 B
assets/WidgetToggleSwitch-DPJMnc2A.js (new) 1.58 kB 🔴 +1.58 kB 🔴 +759 B 🔴 +663 B
assets/MediaImageBottom-BLzQvxLF.js (new) 1.57 kB 🔴 +1.57 kB 🔴 +742 B 🔴 +650 B
assets/MediaImageBottom-CXPQOJPv.js (removed) 1.57 kB 🟢 -1.57 kB 🟢 -744 B 🟢 -648 B
assets/MediaAudioBottom-2CIYAlAT.js (new) 1.52 kB 🔴 +1.52 kB 🔴 +740 B 🔴 +657 B
assets/MediaAudioBottom-DDqxnWfW.js (removed) 1.52 kB 🟢 -1.52 kB 🟢 -744 B 🟢 -656 B
assets/MediaVideoBottom-Bpk2urLh.js (new) 1.52 kB 🔴 +1.52 kB 🔴 +736 B 🔴 +659 B
assets/MediaVideoBottom-qENNMss4.js (removed) 1.52 kB 🟢 -1.52 kB 🟢 -741 B 🟢 -656 B
assets/Media3DBottom-Br5sVsg1.js (new) 1.5 kB 🔴 +1.5 kB 🔴 +730 B 🔴 +654 B
assets/Media3DBottom-C-OiGwUw.js (removed) 1.5 kB 🟢 -1.5 kB 🟢 -735 B 🟢 -651 B
assets/Media3DTop-CO4CseO7.js (new) 1.49 kB 🔴 +1.49 kB 🔴 +765 B 🔴 +655 B
assets/Media3DTop-Db-_aoFS.js (removed) 1.49 kB 🟢 -1.49 kB 🟢 -767 B 🟢 -649 B
assets/MediaAudioTop-BPDWO8-i.js (new) 1.46 kB 🔴 +1.46 kB 🔴 +740 B 🔴 +616 B
assets/MediaAudioTop-CxoCWIb1.js (removed) 1.46 kB 🟢 -1.46 kB 🟢 -741 B 🟢 -617 B
assets/WidgetSelect-BZYpUEYx.js (new) 655 B 🔴 +655 B 🔴 +342 B 🔴 +289 B
assets/WidgetSelect-DaIoAc7o.js (removed) 655 B 🟢 -655 B 🟢 -344 B 🟢 -308 B
assets/WidgetInputNumber-CKX2dyhy.js (removed) 595 B 🟢 -595 B 🟢 -331 B 🟢 -274 B
assets/WidgetInputNumber-LU1k6TJ7.js (new) 595 B 🔴 +595 B 🔴 +331 B 🔴 +277 B
assets/Load3D-B2-HqSEm.js (new) 424 B 🔴 +424 B 🔴 +267 B 🔴 +223 B
assets/Load3D-BQ5vBKnm.js (removed) 424 B 🟢 -424 B 🟢 -267 B 🟢 -225 B
assets/WidgetLegacy-B1-OtCk4.js (removed) 364 B 🟢 -364 B 🟢 -238 B 🟢 -201 B
assets/WidgetLegacy-BOUkCpAd.js (new) 364 B 🔴 +364 B 🔴 +238 B 🔴 +193 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-B1JflQcI.js 72.2 kB 72.2 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-B2lyXe48.js 114 kB 114 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-B9XEQ-pc.js 94 kB 94 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-BErKFzc-.js 73.1 kB 73.1 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-Bf7Tze-u.js 83.4 kB 83.4 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-BhGMcO4Q.js 84.3 kB 84.3 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-CPZUloNQ.js 99 kB 99 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-Cw9RZWRY.js 89 B 89 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-Dva0z-T2.js 86.5 kB 86.5 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/main-un0K9wDS.js 81.8 kB 81.8 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-8e6QYQW0.js 283 kB 283 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-A_9dx4yn.js 304 kB 304 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-BbD3HDi7.js 307 kB 307 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-BOJhIPft.js 369 kB 369 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-Bw_Jitw_.js 101 B 101 B ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-C-Pw33mW.js 317 kB 317 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-ChLyG0UJ.js 285 kB 285 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-CUVPxA4l.js 342 kB 342 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-Dx5Y4xrW.js 310 kB 310 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/nodeDefs-JqO5mNmW.js 306 kB 306 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B
assets/widgetPropFilter-BIbGSUAt.js 1.28 kB 1.28 kB ⚪ 0 B ⚪ 0 B ⚪ 0 B

Status: 23 added / 23 removed

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d18583 and 1dbca30.

📒 Files selected for processing (4)
  • src/core/graph/widgets/dynamicWidgets.ts (2 hunks)
  • src/lib/litegraph/src/LGraphNode.ts (2 hunks)
  • src/lib/litegraph/src/utils/type.ts (2 hunks)
  • src/utils/typeGuardUtil.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • src/utils/typeGuardUtil.ts
🧰 Additional context used
📓 Path-based instructions (8)
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/type.ts
  • src/core/graph/widgets/dynamicWidgets.ts
  • src/lib/litegraph/src/LGraphNode.ts
src/**/*.ts

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

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

Files:

  • src/lib/litegraph/src/utils/type.ts
  • src/core/graph/widgets/dynamicWidgets.ts
  • src/lib/litegraph/src/LGraphNode.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/lib/litegraph/src/utils/type.ts
  • src/core/graph/widgets/dynamicWidgets.ts
  • src/lib/litegraph/src/LGraphNode.ts
src/**/*.{vue,ts,tsx}

📄 CodeRabbit inference engine (src/CLAUDE.md)

Follow Vue 3 composition API style guide

Files:

  • src/lib/litegraph/src/utils/type.ts
  • src/core/graph/widgets/dynamicWidgets.ts
  • src/lib/litegraph/src/LGraphNode.ts
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 the pnpm lint:fix command
Take advantage of TypedArray subarray when appropriate
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
Prefer single line if syntax 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 JavaScript undefined over null

Files:

  • src/lib/litegraph/src/utils/type.ts
  • src/lib/litegraph/src/LGraphNode.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/type.ts
  • src/lib/litegraph/src/LGraphNode.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript exclusively; no new JavaScript code

Files:

  • src/lib/litegraph/src/utils/type.ts
  • src/core/graph/widgets/dynamicWidgets.ts
  • src/lib/litegraph/src/LGraphNode.ts
**/*.{ts,vue}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,vue}: Use camelCase for variable and function names
Indent with 2 spaces (see .prettierrc)
Use single quotes for strings (see .prettierrc)
No trailing semicolons (see .prettierrc)
Maximum line width of 80 characters (see .prettierrc)
Sort and group imports by plugin (run pnpm format before committing)
Never use any type; use proper TypeScript types instead
Never use as any type assertions; fix the underlying type issue instead
Avoid code comments unless absolutely necessary; write expressive, self-documenting code instead
When writing new code, ask if there is a simpler way to introduce the same functionality; if yes, choose the simpler approach
Use refactoring to make complex code simpler
Use es-toolkit for utility functions
Use Vite for fast development and building
Implement proper error handling
Write tests for all changes, especially bug fixes to catch future regressions

Files:

  • src/lib/litegraph/src/utils/type.ts
  • src/core/graph/widgets/dynamicWidgets.ts
  • src/lib/litegraph/src/LGraphNode.ts
🧠 Learnings (12)
📚 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/**/*.ts : Use es-toolkit for utility functions

Applied to files:

  • src/lib/litegraph/src/utils/type.ts
  • src/core/graph/widgets/dynamicWidgets.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/utils/type.ts
  • src/core/graph/widgets/dynamicWidgets.ts
  • src/lib/litegraph/src/LGraphNode.ts
📚 Learning: 2025-11-24T19:47:34.324Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:34.324Z
Learning: Applies to src/**/*.{ts,tsx,vue} : Implement proper TypeScript types throughout the codebase

Applied to files:

  • src/lib/litegraph/src/utils/type.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/core/graph/widgets/dynamicWidgets.ts
  • src/lib/litegraph/src/LGraphNode.ts
📚 Learning: 2025-11-24T19:47:34.324Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:34.324Z
Learning: Applies to src/**/*.{ts,tsx,vue} : Use es-toolkit for utility functions instead of other utility libraries

Applied to files:

  • src/core/graph/widgets/dynamicWidgets.ts
📚 Learning: 2025-12-06T00:52:35.750Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-06T00:52:35.750Z
Learning: Applies to **/*.{ts,vue} : Use es-toolkit for utility functions

Applied to files:

  • src/core/graph/widgets/dynamicWidgets.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/core/graph/widgets/dynamicWidgets.ts
  • src/lib/litegraph/src/LGraphNode.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/core/graph/widgets/dynamicWidgets.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/core/graph/widgets/dynamicWidgets.ts
  • src/lib/litegraph/src/LGraphNode.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/core/graph/widgets/dynamicWidgets.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} : Prefer single line `if` syntax over adding curly braces, when the statement has a very concise expression and concise, single line statement

Applied to files:

  • src/core/graph/widgets/dynamicWidgets.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} : 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/LGraphNode.ts
🧬 Code graph analysis (3)
src/lib/litegraph/src/utils/type.ts (1)
src/lib/litegraph/src/interfaces.ts (1)
  • ISlotType (281-281)
src/core/graph/widgets/dynamicWidgets.ts (1)
src/lib/litegraph/src/utils/type.ts (1)
  • commonType (32-44)
src/lib/litegraph/src/LGraphNode.ts (1)
src/lib/litegraph/src/utils/type.ts (1)
  • commonType (32-44)
⏰ 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). (4)
  • GitHub Check: setup
  • GitHub Check: test
  • GitHub Check: lint-and-format
  • GitHub Check: collect
🔇 Additional comments (6)
src/lib/litegraph/src/utils/type.ts (2)

32-44: Well-structured utility for type intersection.

The implementation correctly handles wildcards, comma-separated type lists, and returns undefined when no common type exists. The use of es-toolkit's without follows coding guidelines.


56-58: LGTM!

Simple and effective type guard for filtering string slot types.

src/lib/litegraph/src/LGraphNode.ts (2)

13-13: LGTM!

Clean import consolidation with toClass that was previously imported elsewhere.


2835-2846: LGTM! Correct implementation of common type resolution.

The short-circuit evaluation ensures commonType is only called with truthy types, and the fallback chain (maybeCommonType || input.type || output.type) correctly handles cases where no common type exists. This properly addresses the PR objective of coloring links by the greatest common type.

src/core/graph/widgets/dynamicWidgets.ts (2)

11-11: LGTM!

Clean import migration from local combineTypes implementation to the centralized commonType utility.


291-303: LGTM! Clean migration to centralized type utility.

The commonType usage correctly computes:

  1. Each input's acceptable type by intersecting other connected types with the original allowed types
  2. The output type from all connected input types

The error handling appropriately catches invalid connection states.

.map(([key]) => key)
}

function isStrings(types: unknown[]): types is string[] {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A little conflicted about moving this here, but I think it's good enough.
+ commonType should be in litegraph and should see greater use.
+ Having litegraph reference outside code is bad.
- There's some conflation of litegraph connection types and programming types.
- The function is no longer exported. It's less clear that it's intended as utility.

Copy link
Contributor

Choose a reason for hiding this comment

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

Intent is less important than how it's currently being used, so I support this.
If we had something that was serving as a utility and could be put into the frontend utilities package for use here, that would also be good, but YAGNI.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1dbca30 and f57b3d1.

📒 Files selected for processing (1)
  • src/lib/litegraph/src/utils/type.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
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/type.ts
src/**/*.ts

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

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

Files:

  • src/lib/litegraph/src/utils/type.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/lib/litegraph/src/utils/type.ts
src/**/*.{vue,ts,tsx}

📄 CodeRabbit inference engine (src/CLAUDE.md)

Follow Vue 3 composition API style guide

Files:

  • src/lib/litegraph/src/utils/type.ts
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 the pnpm lint:fix command
Take advantage of TypedArray subarray when appropriate
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
Prefer single line if syntax 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 JavaScript undefined over null

Files:

  • src/lib/litegraph/src/utils/type.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/type.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript exclusively; no new JavaScript code

Files:

  • src/lib/litegraph/src/utils/type.ts
**/*.{ts,vue}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,vue}: Use camelCase for variable and function names
Indent with 2 spaces (see .prettierrc)
Use single quotes for strings (see .prettierrc)
No trailing semicolons (see .prettierrc)
Maximum line width of 80 characters (see .prettierrc)
Sort and group imports by plugin (run pnpm format before committing)
Never use any type; use proper TypeScript types instead
Never use as any type assertions; fix the underlying type issue instead
Avoid code comments unless absolutely necessary; write expressive, self-documenting code instead
When writing new code, ask if there is a simpler way to introduce the same functionality; if yes, choose the simpler approach
Use refactoring to make complex code simpler
Use es-toolkit for utility functions
Use Vite for fast development and building
Implement proper error handling
Write tests for all changes, especially bug fixes to catch future regressions

Files:

  • src/lib/litegraph/src/utils/type.ts
🧠 Learnings (5)
📚 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/**/*.ts : Use es-toolkit for utility functions

Applied to files:

  • src/lib/litegraph/src/utils/type.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/utils/type.ts
📚 Learning: 2025-11-24T19:47:34.324Z
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:34.324Z
Learning: Applies to src/**/*.{ts,tsx,vue} : Implement proper TypeScript types throughout the codebase

Applied to files:

  • src/lib/litegraph/src/utils/type.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/type.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/type.ts
🧬 Code graph analysis (1)
src/lib/litegraph/src/utils/type.ts (1)
src/lib/litegraph/src/interfaces.ts (1)
  • ISlotType (281-281)
⏰ 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). (4)
  • GitHub Check: setup
  • GitHub Check: lint-and-format
  • GitHub Check: collect
  • GitHub Check: test
🔇 Additional comments (1)
src/lib/litegraph/src/utils/type.ts (1)

1-3: Imports align with utility and typing guidelines

Using without from es-toolkit and bringing in ISlotType via a type-only import is consistent with the repo’s guidance to centralize utilities and enforce strong typing; nothing to change here.

Based on learnings, this matches the preference for es-toolkit and explicit TypeScript types.

Comment on lines +32 to +58
export function commonType(...types: ISlotType[]): ISlotType | undefined {
if (!isStrings(types)) return undefined

const withoutWildcards = without(types, '*')
if (withoutWildcards.length === 0) return '*'

const typeLists: string[][] = withoutWildcards.map((type) => type.split(','))

const combinedTypes = intersection(...typeLists)
if (combinedTypes.length === 0) return undefined

return combinedTypes.join(',')
}

function intersection(...sets: string[][]): string[] {
const itemCounts: Record<string, number> = {}
for (const set of sets)
for (const item of new Set(set))
itemCounts[item] = (itemCounts[item] ?? 0) + 1
return Object.entries(itemCounts)
.filter(([, count]) => count === sets.length)
.map(([key]) => key)
}

function isStrings(types: unknown[]): types is string[] {
return types.every((t) => typeof t === 'string')
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Tighten commonType edge cases and confirm numeric ISlotType handling

The core behavior (ignoring '*' except when all types are wildcards, intersecting comma‑separated lists, and returning undefined on empty intersections) looks correct for the link‑coloring use case. The intersection helper correctly de‑duplicates within each set and preserves first‑set ordering.

Two edge cases are worth tightening/confirming:

  1. Zero‑argument calls return '*'
    With no arguments, isStrings([]) passes, withoutWildcards is [], and commonType() returns '*'. That’s a bit surprising; “no information” arguably should yield undefined, not “any”. You can make this explicit with an early guard:

    export function commonType(...types: ISlotType[]): ISlotType | undefined {
  • if (!isStrings(types)) return undefined
  • if (types.length === 0) return undefined
  • if (!isStrings(types)) return undefined
    
    
    
    
  1. Numeric ISlotType values are silently dropped
    ISlotType includes number, but commonType currently bails out (undefined) if any non‑string appears. If numeric slot types are still used anywhere in LGraphNode/widgets, this could regress link type inference for those paths. If not, it may be fine, but it’s worth double‑checking the call sites and, if needed, documenting that commonType is string‑only.

Additionally, if any callers ever produce comma‑separated lists with spaces (e.g. 'image, mask'), the lack of trimming could prevent expected intersections (' mask' vs 'mask'); if that’s a realistic input, consider normalizing entries before counting.

If you confirm that commonType is only ever called with 1+ string slot types, the current design is good; otherwise, consider the guard tweak above and/or handling numeric types explicitly.
Based on learnings, this keeps the utility type‑safe while matching the project’s TypeScript and es-toolkit usage patterns.

🤖 Prompt for AI Agents
In src/lib/litegraph/src/utils/type.ts around lines 32–58, add an explicit guard
so commonType() returns undefined when called with zero arguments (types.length
=== 0) instead of returning '*'; also tighten input handling by normalizing slot
entries: allow numeric ISlotType by converting numbers to strings (or update the
type-guard to accept number | string), and when splitting comma lists trim each
entry before building the intersection to avoid mismatches caused by whitespace.
Ensure intersection still de-duplicates per set and that the final result joins
the normalized strings or returns undefined when empty.

@AustinMroz AustinMroz merged commit a8f6bea into main Dec 6, 2025
27 checks passed
@AustinMroz AustinMroz deleted the austin/common-link-type branch December 6, 2025 20:00
AustinMroz added a commit that referenced this pull request Dec 7, 2025
Quick followup adding tests to #7211

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7213-Add-tests-for-link-type-2c16d73d365081898707f94a40f2e866)
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:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reroute Nodes and Wires Should Inherit Upstream Output Color

3 participants