Fix #346 last reroute is never deleted (#766)

Clears the reroutes in extras when exporting for serialisation, if none
exist.

- Resolves #346
This commit is contained in:
filtered
2025-03-13 11:35:05 +11:00
committed by GitHub
parent 486c5ad6c0
commit bcaeccfc45

View File

@@ -1472,13 +1472,13 @@ export class LGraph implements LinkNetwork, Serialisable<SerialisableGraph> {
const links = linkArray.map(x => x.serialize())
if (reroutes.length) {
extra.reroutes = reroutes
// Link parent IDs cannot go in 0.4 schema arrays
extra.linkExtensions = linkArray
.filter(x => x.parentId !== undefined)
.map(x => ({ id: x.id, parentId: x.parentId }))
}
extra.reroutes = reroutes.length ? reroutes : undefined
return {
last_node_id: state.lastNodeId,
last_link_id: state.lastLinkId,