add comment

This commit is contained in:
TomoyukiMizuma 2023-08-24 09:04:14 +09:00
parent 80e9544763
commit 7c91559e64
2 changed files with 5 additions and 3 deletions

View File

@ -1095,8 +1095,9 @@ export class ComfyApp {
this.loadGraphData(workflow); this.loadGraphData(workflow);
restored = true; restored = true;
const workflow_id = localStorage.getItem("workflow_current_id"); const workflow_id = localStorage.getItem("workflow_current_id");
if (workflow_id) if (workflow_id) {
this.workflow_current_id = workflow_id; this.workflow_current_id = workflow_id;
}
} }
} catch (err) { } catch (err) {
console.error("Error loading previous workflow", err); console.error("Error loading previous workflow", err);
@ -1109,7 +1110,7 @@ export class ComfyApp {
// Save current workflow automatically // Save current workflow automatically
setInterval(() => { 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())); localStorage.setItem("workflow", JSON.stringify(this.graph.serialize()));
} }
}, 1000); }, 1000);
@ -1610,7 +1611,7 @@ export class ComfyApp {
} }
switchWorkflow(selected_id) { 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 const workflow_count = 10; // also used in getWorkflowNames function
try { try {

View File

@ -779,6 +779,7 @@ export class ComfyUI {
this.switch_workflow_combo = document.getElementById("comfy-switch-workflow-combo"); this.switch_workflow_combo = document.getElementById("comfy-switch-workflow-combo");
window.addEventListener("focus", () => { 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); localStorage.setItem("workflow_current_id", this.switch_workflow_combo.selectedIndex);
}); });