mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): copied edges must have new ids set
Problems this was causing: - Deleting an edge was a copy of another edge deletes both edges - Deleting a node that was a copy-with-edges of another node deletes its edges and it's original edges, leaving what I will call "ghost noodles" behind
This commit is contained in:
parent
ba747373db
commit
bb876b8d4e
@ -59,17 +59,19 @@ const pasteSelection = (withEdgesToCopiedNodes?: boolean) => {
|
|||||||
for (const edge of copiedEdges) {
|
for (const edge of copiedEdges) {
|
||||||
if (edge.source === node.id) {
|
if (edge.source === node.id) {
|
||||||
edge.source = id;
|
edge.source = id;
|
||||||
edge.id = edge.id.replace(node.data.id, id);
|
} else if (edge.target === node.id) {
|
||||||
}
|
|
||||||
if (edge.target === node.id) {
|
|
||||||
edge.target = id;
|
edge.target = id;
|
||||||
edge.id = edge.id.replace(node.data.id, id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
node.id = id;
|
node.id = id;
|
||||||
node.data.id = id;
|
node.data.id = id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
copiedEdges.forEach((edge) => {
|
||||||
|
// Copied edges need a fresh id too
|
||||||
|
edge.id = uuidv4();
|
||||||
|
});
|
||||||
|
|
||||||
const nodeChanges: NodeChange[] = [];
|
const nodeChanges: NodeChange[] = [];
|
||||||
const edgeChanges: EdgeChange[] = [];
|
const edgeChanges: EdgeChange[] = [];
|
||||||
// Deselect existing nodes
|
// Deselect existing nodes
|
||||||
|
Loading…
Reference in New Issue
Block a user