From 238128b6eb6319bf20cbeaa1a4a05d4d45892d36 Mon Sep 17 00:00:00 2001 From: space-nuko <24979496+space-nuko@users.noreply.github.com> Date: Sat, 20 May 2023 10:39:20 -0500 Subject: [PATCH] More efficient loading for combo widget --- litegraph | 2 +- src/lib/nodes/widgets/ComfyComboNode.ts | 4 +- src/lib/widgets/ComboWidget.svelte | 145 ++++++++++++------------ 3 files changed, 76 insertions(+), 75 deletions(-) diff --git a/litegraph b/litegraph index db6a916..e326ab3 160000 --- a/litegraph +++ b/litegraph @@ -1 +1 @@ -Subproject commit db6a9167575db269524564d5527c512a06c0f8d2 +Subproject commit e326ab331e39b4c4c43f3f10666e384781776e3f diff --git a/src/lib/nodes/widgets/ComfyComboNode.ts b/src/lib/nodes/widgets/ComfyComboNode.ts index bb8b5f9..de6fedd 100644 --- a/src/lib/nodes/widgets/ComfyComboNode.ts +++ b/src/lib/nodes/widgets/ComfyComboNode.ts @@ -40,13 +40,13 @@ export default class ComfyComboNode extends ComfyWidgetNode { // Wait until the initial graph load for combo to be valid. firstLoad: Writable; lightUp: Writable; - valuesForCombo: Writable; // Changed when the combo box has values. + valuesForCombo: Writable; // Changed when the combo box has values. constructor(name?: string) { super(name, "A") this.firstLoad = writable(false) this.lightUp = writable(true) - this.valuesForCombo = writable(null) + this.valuesForCombo = writable([]) } override onPropertyChanged(property: any, value: any) { diff --git a/src/lib/widgets/ComboWidget.svelte b/src/lib/widgets/ComboWidget.svelte index ec384a0..cb28b69 100644 --- a/src/lib/widgets/ComboWidget.svelte +++ b/src/lib/widgets/ComboWidget.svelte @@ -11,10 +11,10 @@ export let widget: WidgetLayout | null = null; export let isMobile: boolean = false; let node: ComfyComboNode | null = null; - let nodeValue: Writable | null = null; + let nodeValue: Writable = writable(""); let propsChanged: Writable | null = null; let lightUp: Writable = writable(false); - let valuesForCombo: Writable | null = null; + let valuesForCombo: Writable = writable([]) let lastConfigured: any = null; let option: any = null; @@ -132,77 +132,69 @@
- {#key $valuesForCombo} - {#if node !== null && nodeValue !== null} - {#if $valuesForCombo == null} - Loading... - {:else} - - {/if} +