From bb02f935ff5eeb24d31ef35506e0b5291314d081 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 17 Jul 2024 22:30:36 -0400 Subject: [PATCH] Revert "Fix node searchbox default value setting (#150)" (#151) This reverts commit 3dfef8a73ef57fe67d6a3db68d1dc3895e744e63. --- browser_tests/nodeSearchBox.spec.ts | 13 ++++++++++++- src/scripts/ui.ts | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/browser_tests/nodeSearchBox.spec.ts b/browser_tests/nodeSearchBox.spec.ts index 86a062527..f66d6d807 100644 --- a/browser_tests/nodeSearchBox.spec.ts +++ b/browser_tests/nodeSearchBox.spec.ts @@ -1,6 +1,17 @@ import { expect } from "@playwright/test"; -import { comfyPageFixture as test} from "./ComfyPage"; +import { ComfyPage, comfyPageFixture } from "./ComfyPage"; +export const test = comfyPageFixture.extend<{ comfyPage: ComfyPage }>({ + comfyPage: async ({ comfyPage }, use) => { + await comfyPage.page.evaluate(async () => { + await window["app"].ui.settings.setSettingValueAsync( + "Comfy.NodeSearchBoxImpl", + "default" + ); + }); + await use(comfyPage); + }, +}); test.describe("Node search box", () => { test("Can trigger on empty canvas double click", async ({ comfyPage }) => { diff --git a/src/scripts/ui.ts b/src/scripts/ui.ts index b45afe28f..81c6ba20a 100644 --- a/src/scripts/ui.ts +++ b/src/scripts/ui.ts @@ -429,9 +429,9 @@ export class ComfyUI { options: ["default", "litegraph (legacy)"], defaultValue: "default", onChange: (value?: string) => { + if (value === undefined) return; if (!app.canvas) return; - value = value || "default"; const useLitegraphSearch = value === "litegraph (legacy)"; app.canvas.allow_searchbox = useLitegraphSearch; document.dispatchEvent(