mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-13 23:12:35 +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
|
// 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.#addDrawNodeHandler();
|
||||||
this.#addDrawGroupsHandler();
|
this.#addDrawGroupsHandler();
|
||||||
|
|||||||
@ -777,6 +777,13 @@ export class ComfyUI {
|
|||||||
]);
|
]);
|
||||||
this.is_launchTiming = true;
|
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 id_renameWorkflow = "Comfy.RenameWorkflowDialog";
|
||||||
const renameWorkflow = this.settings.addSetting({
|
const renameWorkflow = this.settings.addSetting({
|
||||||
id: id_renameWorkflow,
|
id: id_renameWorkflow,
|
||||||
@ -839,11 +846,10 @@ export class ComfyUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.is_launchTiming && typeof app != "undefined") {
|
if (this.is_launchTiming && typeof app != "undefined") {
|
||||||
const switch_workflow_combo = document.getElementById("comfy-switch-workflow-combo");
|
this.switch_workflow_combo.selectedIndex = app.workflow_current_id;
|
||||||
switch_workflow_combo.selectedIndex = app.workflow_current_id;
|
|
||||||
|
|
||||||
const workflow_names = app.getWorkflowNames();
|
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 ~ )");
|
console.assert(options.length === workflow_names.length, "workflow_count != the count of $el(option ~ )");
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user