Unverified Commit ab93abd4 authored by pythongosssss's avatar pythongosssss Committed by GitHub
Browse files

Prevent cleaning graph state on undo/redo (#2255)

* Prevent cleaning graph state on undo/redo

* Remove pause rendering due to LG bug
parent 57926635
...@@ -71,24 +71,21 @@ function graphEqual(a, b, root = true) { ...@@ -71,24 +71,21 @@ function graphEqual(a, b, root = true) {
} }
const undoRedo = async (e) => { const undoRedo = async (e) => {
if (e.ctrlKey || e.metaKey) { const updateState = async (source, target) => {
if (e.key === "y") { const prevState = source.pop();
const prevState = redo.pop();
if (prevState) { if (prevState) {
undo.push(activeState); target.push(activeState);
isOurLoad = true; isOurLoad = true;
await app.loadGraphData(prevState); await app.loadGraphData(prevState, false);
activeState = prevState; activeState = prevState;
} }
}
if (e.ctrlKey || e.metaKey) {
if (e.key === "y") {
updateState(redo, undo);
return true; return true;
} else if (e.key === "z") { } else if (e.key === "z") {
const prevState = undo.pop(); updateState(undo, redo);
if (prevState) {
redo.push(activeState);
isOurLoad = true;
await app.loadGraphData(prevState);
activeState = prevState;
}
return true; return true;
} }
} }
......
...@@ -1559,9 +1559,12 @@ export class ComfyApp { ...@@ -1559,9 +1559,12 @@ export class ComfyApp {
/** /**
* Populates the graph with the specified workflow data * Populates the graph with the specified workflow data
* @param {*} graphData A serialized graph object * @param {*} graphData A serialized graph object
* @param { boolean } clean If the graph state, e.g. images, should be cleared
*/ */
async loadGraphData(graphData) { async loadGraphData(graphData, clean = true) {
if (clean !== false) {
this.clean(); this.clean();
}
let reset_invalid_values = false; let reset_invalid_values = false;
if (!graphData) { if (!graphData) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment