mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-11 14:02:37 +08:00
Fixed a bug that occurred when working on workflows in more than one browser tab.
This commit is contained in:
parent
c8a62ca716
commit
46db5de0f4
@ -1108,7 +1108,11 @@ export class ComfyApp {
|
||||
}
|
||||
|
||||
// Save current workflow automatically
|
||||
setInterval(() => localStorage.setItem("workflow", JSON.stringify(this.graph.serialize())), 1000);
|
||||
setInterval(() => {
|
||||
if (document.visibilityState === "visible") {
|
||||
localStorage.setItem("workflow", JSON.stringify(this.graph.serialize()));
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
this.#addDrawNodeHandler();
|
||||
this.#addDrawGroupsHandler();
|
||||
|
||||
@ -777,6 +777,13 @@ 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);
|
||||
}
|
||||
});
|
||||
|
||||
const id_renameWorkflow = "Comfy.RenameWorkflowDialog";
|
||||
const renameWorkflow = this.settings.addSetting({
|
||||
id: id_renameWorkflow,
|
||||
@ -839,11 +846,10 @@ export class ComfyUI {
|
||||
}
|
||||
|
||||
if (this.is_launchTiming && typeof app != "undefined") {
|
||||
const switch_workflow_combo = document.getElementById("comfy-switch-workflow-combo");
|
||||
switch_workflow_combo.selectedIndex = app.workflow_current_id;
|
||||
this.switch_workflow_combo.selectedIndex = app.workflow_current_id;
|
||||
|
||||
const workflow_names = app.getWorkflowNames();
|
||||
const options = switch_workflow_combo.options;
|
||||
const options = this.switch_workflow_combo.options;
|
||||
|
||||
console.assert(options.length === workflow_names.length, "workflow_count != the count of $el(option ~ )");
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user