Fixed a bug that occurred when working on workflows in more than one window.

This commit is contained in:
TomoyukiMizuma 2023-08-23 23:35:55 +09:00
parent 46db5de0f4
commit 80e9544763
2 changed files with 3 additions and 5 deletions

View File

@ -1109,7 +1109,7 @@ export class ComfyApp {
// Save current workflow automatically
setInterval(() => {
if (document.visibilityState === "visible") {
if (document.hasFocus()) {
localStorage.setItem("workflow", JSON.stringify(this.graph.serialize()));
}
}, 1000);

View File

@ -778,10 +778,8 @@ export class ComfyUI {
this.is_launchTiming = true;
this.switch_workflow_combo = document.getElementById("comfy-switch-workflow-combo");
document.addEventListener("visibilitychange", () => {
if (document.visibilityState === "visible") {
localStorage.setItem("workflow_current_id", this.switch_workflow_combo.selectedIndex);
}
window.addEventListener("focus", () => {
localStorage.setItem("workflow_current_id", this.switch_workflow_combo.selectedIndex);
});
const id_renameWorkflow = "Comfy.RenameWorkflowDialog";