Fix double trigger of setting onChange callback (#1385)

* Fix onChange double trigger

* nit

* Add playwright test
This commit is contained in:
Chenlei Hu
2024-10-30 19:55:46 -04:00
committed by GitHub
parent 67ee8726ef
commit 94f4147f92
5 changed files with 90 additions and 21 deletions

View File

@@ -160,7 +160,6 @@ export class ComfySettingsDialog extends ComfyDialog<HTMLDialogElement> {
throw new Error(`Setting ${id} of type ${type} must have a unique ID.`)
}
let skipOnChange = false
let value = this.getSettingValue(id)
if (value == null) {
if (this.app.isNewUserSession) {
@@ -177,10 +176,8 @@ export class ComfySettingsDialog extends ComfyDialog<HTMLDialogElement> {
}
// Trigger initial setting of value
if (!skipOnChange) {
onChange?.(value, undefined)
this.#dispatchChange(id, value)
}
onChange?.(value, undefined)
this.#dispatchChange(id, value)
this.settingsParamLookup[id] = params
if (this.app.vueAppReady) {