From 7c91559e6462e6a3b08b2195b7f4196a05bff0fa Mon Sep 17 00:00:00 2001 From: TomoyukiMizuma Date: Thu, 24 Aug 2023 09:04:14 +0900 Subject: [PATCH] add comment --- web/scripts/app.js | 7 ++++--- web/scripts/ui.js | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/web/scripts/app.js b/web/scripts/app.js index 3cbd8eb9a..eb459b73f 100644 --- a/web/scripts/app.js +++ b/web/scripts/app.js @@ -1095,8 +1095,9 @@ export class ComfyApp { this.loadGraphData(workflow); restored = true; const workflow_id = localStorage.getItem("workflow_current_id"); - if (workflow_id) + if (workflow_id) { this.workflow_current_id = workflow_id; + } } } catch (err) { console.error("Error loading previous workflow", err); @@ -1109,7 +1110,7 @@ export class ComfyApp { // Save current workflow automatically setInterval(() => { - if (document.hasFocus()) { + if (document.hasFocus()) { // only workflow of the active browser tab in the active window localStorage.setItem("workflow", JSON.stringify(this.graph.serialize())); } }, 1000); @@ -1610,7 +1611,7 @@ export class ComfyApp { } switchWorkflow(selected_id) { - // If you change the value of this workflow_count, you also need to change the count of `$el("option"~` (ui.js). + // If you change the value of this workflow_count, you also need to change the count of `$el("option"~` (ui.js). (count up only) const workflow_count = 10; // also used in getWorkflowNames function try { diff --git a/web/scripts/ui.js b/web/scripts/ui.js index 68de5a67d..3f54ab09d 100644 --- a/web/scripts/ui.js +++ b/web/scripts/ui.js @@ -779,6 +779,7 @@ export class ComfyUI { this.switch_workflow_combo = document.getElementById("comfy-switch-workflow-combo"); window.addEventListener("focus", () => { + // to need to keep the workflow_current_id and selectedIndex to be the same value localStorage.setItem("workflow_current_id", this.switch_workflow_combo.selectedIndex); });