From 88ca25c97cd29760e5f9718011ccbbb818c8bc83 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Wed, 17 May 2023 11:40:19 -0500 Subject: [PATCH] Fix subgraph connections --- litegraph | 2 +- package.json | 1 + pnpm-lock.yaml | 89 +---------------------------------- src/lib/ComfyGraph.ts | 8 +++- src/lib/stores/layoutState.ts | 1 - 5 files changed, 10 insertions(+), 91 deletions(-) diff --git a/litegraph b/litegraph index 4c88137..06db1ba 160000 --- a/litegraph +++ b/litegraph @@ -1 +1 @@ -Subproject commit 4c8813722e42388a8f3e20f2b9c2290641912ef4 +Subproject commit 06db1ba07907bc1f2701610c7006f4867728c991 diff --git a/package.json b/package.json index 7b9d40a..46c87bb 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch", "test": "vitest run", "test:watch": "vitest", + "test:inspect": "vitest --inspect-brk --single-thread", "lint": "prettier --plugin-search-dir . --check . && eslint .", "format": "prettier --plugin-search-dir . --write .", "svelte-check": "svelte-check", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 50d3a51..06df85c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -780,7 +780,7 @@ importers: version: 4.10.1(postcss-load-config@3.1.4)(postcss@8.4.21)(svelte@3.58.0)(typescript@4.5.4) tailwindcss: specifier: ^3.0.12 - version: 3.3.1(postcss@8.4.21) + version: 3.3.1 tslib: specifier: ^2.3.1 version: 2.5.0 @@ -7105,17 +7105,6 @@ packages: prettier: 2.8.7 dev: false - /postcss-import@14.1.0: - resolution: {integrity: sha512-flwI+Vgm4SElObFVPpTIT7SU7R3qk2L7PyduMcokiaVKuWv9d/U+Gm/QAd8NDLuykTWTkcrjOeD2Pp1rMeBTGw==} - engines: {node: '>=10.0.0'} - peerDependencies: - postcss: ^8.0.0 - dependencies: - postcss-value-parser: 4.2.0 - read-cache: 1.0.0 - resolve: 1.22.2 - dev: false - /postcss-import@14.1.0(postcss@8.4.21): resolution: {integrity: sha512-flwI+Vgm4SElObFVPpTIT7SU7R3qk2L7PyduMcokiaVKuWv9d/U+Gm/QAd8NDLuykTWTkcrjOeD2Pp1rMeBTGw==} engines: {node: '>=10.0.0'} @@ -7126,16 +7115,6 @@ packages: postcss-value-parser: 4.2.0 read-cache: 1.0.0 resolve: 1.22.2 - dev: true - - /postcss-js@4.0.1: - resolution: {integrity: sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==} - engines: {node: ^12 || ^14 || >= 16} - peerDependencies: - postcss: ^8.4.21 - dependencies: - camelcase-css: 2.0.1 - dev: false /postcss-js@4.0.1(postcss@8.4.21): resolution: {integrity: sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==} @@ -7145,23 +7124,6 @@ packages: dependencies: camelcase-css: 2.0.1 postcss: 8.4.21 - dev: true - - /postcss-load-config@3.1.4: - resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==} - engines: {node: '>= 10'} - peerDependencies: - postcss: '>=8.0.9' - ts-node: '>=9.0.0' - peerDependenciesMeta: - postcss: - optional: true - ts-node: - optional: true - dependencies: - lilconfig: 2.1.0 - yaml: 1.10.2 - dev: false /postcss-load-config@3.1.4(postcss@8.4.21): resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==} @@ -7178,16 +7140,6 @@ packages: lilconfig: 2.1.0 postcss: 8.4.21 yaml: 1.10.2 - dev: true - - /postcss-nested@6.0.0: - resolution: {integrity: sha512-0DkamqrPcmkBDsLn+vQDIrtkSbNkv5AD/M322ySo9kqFkCIYklym2xEmWkwo+Y3/qZo34tzEPNUw4y7yMCdv5w==} - engines: {node: '>=12.0'} - peerDependencies: - postcss: ^8.2.14 - dependencies: - postcss-selector-parser: 6.0.11 - dev: false /postcss-nested@6.0.0(postcss@8.4.21): resolution: {integrity: sha512-0DkamqrPcmkBDsLn+vQDIrtkSbNkv5AD/M322ySo9kqFkCIYklym2xEmWkwo+Y3/qZo34tzEPNUw4y7yMCdv5w==} @@ -7197,7 +7149,6 @@ packages: dependencies: postcss: 8.4.21 postcss-selector-parser: 6.0.11 - dev: true /postcss-prefix-selector@1.16.0(postcss@8.4.21): resolution: {integrity: sha512-rdVMIi7Q4B0XbXqNUEI+Z4E+pueiu/CS5E6vRCQommzdQ/sgsS4dK42U7GX8oJR+TJOtT+Qv3GkNo6iijUMp3Q==} @@ -8249,43 +8200,6 @@ packages: resolution: {integrity: sha512-Vkiouc41d4CEq0ujXl6oiGFQ7bA3WEhUZdTgXAhtKxSy49OmKs8rEfQmupsfF0IGW8fv2iQkp1EVUuapCFrZ9g==} engines: {node: '>=12.13.0'} hasBin: true - peerDependencies: - postcss: ^8.0.9 - dependencies: - arg: 5.0.2 - chokidar: 3.5.3 - color-name: 1.1.4 - didyoumean: 1.2.2 - dlv: 1.1.3 - fast-glob: 3.2.12 - glob-parent: 6.0.2 - is-glob: 4.0.3 - jiti: 1.18.2 - lilconfig: 2.1.0 - micromatch: 4.0.5 - normalize-path: 3.0.0 - object-hash: 3.0.0 - picocolors: 1.0.0 - postcss: 8.4.21 - postcss-import: 14.1.0 - postcss-js: 4.0.1 - postcss-load-config: 3.1.4 - postcss-nested: 6.0.0 - postcss-selector-parser: 6.0.11 - postcss-value-parser: 4.2.0 - quick-lru: 5.1.1 - resolve: 1.22.2 - sucrase: 3.32.0 - transitivePeerDependencies: - - ts-node - dev: false - - /tailwindcss@3.3.1(postcss@8.4.21): - resolution: {integrity: sha512-Vkiouc41d4CEq0ujXl6oiGFQ7bA3WEhUZdTgXAhtKxSy49OmKs8rEfQmupsfF0IGW8fv2iQkp1EVUuapCFrZ9g==} - engines: {node: '>=12.13.0'} - hasBin: true - peerDependencies: - postcss: ^8.0.9 dependencies: arg: 5.0.2 chokidar: 3.5.3 @@ -8313,7 +8227,6 @@ packages: sucrase: 3.32.0 transitivePeerDependencies: - ts-node - dev: true /term-size@2.2.1: resolution: {integrity: sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==} diff --git a/src/lib/ComfyGraph.ts b/src/lib/ComfyGraph.ts index d6cab43..19c9e61 100644 --- a/src/lib/ComfyGraph.ts +++ b/src/lib/ComfyGraph.ts @@ -40,8 +40,14 @@ export default class ComfyGraph extends LGraph { this.eventBus.emit("afterExecute"); } + /* + * NOTE: This function will also be called by child subgraphs on their + * parent graphs. So we have to be sure the node that receives the callback + * is a root graph (this._is_subgraph is false). If a subgraph calls this + * then options.subgraphsh will have the list of subgraphs down the chain. + */ override onNodeAdded(node: LGraphNode, options: LGraphAddNodeOptions) { - // Don't add detached subgraphs + // Don't add nodes in subgraphs if (node.getRootGraph() == null || this._is_subgraph) return; diff --git a/src/lib/stores/layoutState.ts b/src/lib/stores/layoutState.ts index 525d263..1fc131a 100644 --- a/src/lib/stores/layoutState.ts +++ b/src/lib/stores/layoutState.ts @@ -837,7 +837,6 @@ function removeEntry(state: LayoutState, id: DragItemID) { function nodeAdded(node: LGraphNode, options: LGraphAddNodeOptions) { const state = get(store) - console.error("NODEADDED", node.type, (node as any).svelteComponentType) if (state.isConfiguring) return;