From a1a8d485441f27723c8f93df9f16fbd53b2bc6bd Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Mon, 11 Aug 2025 09:13:02 -0700 Subject: [PATCH] [feat] Replace removeFromArray with lodash pull (#4906) Co-authored-by: Claude --- src/lib/litegraph/src/subgraph/SubgraphOutput.ts | 5 +++-- src/lib/litegraph/src/utils/collections.ts | 8 -------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/lib/litegraph/src/subgraph/SubgraphOutput.ts b/src/lib/litegraph/src/subgraph/SubgraphOutput.ts index f816286f3..1c3479b84 100644 --- a/src/lib/litegraph/src/subgraph/SubgraphOutput.ts +++ b/src/lib/litegraph/src/subgraph/SubgraphOutput.ts @@ -1,3 +1,5 @@ +import { pull } from 'lodash' + import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode' import { LLink } from '@/lib/litegraph/src/LLink' import type { RerouteId } from '@/lib/litegraph/src/Reroute' @@ -9,7 +11,6 @@ import type { } from '@/lib/litegraph/src/interfaces' import { LiteGraph } from '@/lib/litegraph/src/litegraph' import { NodeSlotType } from '@/lib/litegraph/src/types/globalEnums' -import { removeFromArray } from '@/lib/litegraph/src/utils/collections' import type { SubgraphInput } from './SubgraphInput' import type { SubgraphOutputNode } from './SubgraphOutputNode' @@ -59,7 +60,7 @@ export class SubgraphOutput extends SubgraphSlot { existingLink.disconnect(subgraph, 'input') const resolved = existingLink.resolve(subgraph) const links = resolved.output?.links - if (links) removeFromArray(links, existingLink.id) + if (links) pull(links, existingLink.id) } const link = new LLink( diff --git a/src/lib/litegraph/src/utils/collections.ts b/src/lib/litegraph/src/utils/collections.ts index 422d278a6..85da38382 100644 --- a/src/lib/litegraph/src/utils/collections.ts +++ b/src/lib/litegraph/src/utils/collections.ts @@ -112,11 +112,3 @@ export function findFreeSlotOfType( } return wildSlot ?? occupiedSlot ?? occupiedWildSlot } - -export function removeFromArray(array: T[], value: T): boolean { - const index = array.indexOf(value) - const found = index !== -1 - - if (found) array.splice(index, 1) - return found -}