Add back/forwards compatibility to schema validation (#1501)

* Allow future extensions of added schema objects

* Add explicit versioning to zod schemas

* Extend schema 0.4 with new fields in extras

- Allows Reroutes without using schema v1
- Reroute data is retained when using old versions - simply not displayed

* Add Reroute undo/redo support
This commit is contained in:
filtered
2024-11-11 11:50:18 +11:00
committed by GitHub
parent 58ad01adfe
commit 7bc79edf3d
2 changed files with 45 additions and 24 deletions

View File

@@ -395,8 +395,11 @@ export class ChangeTracker {
return false
}
// Reroutes (schema 0.4)
if (!_.isEqual(a.extra?.reroutes, b.extra?.reroutes)) return false
// Compare other properties normally
for (const key of ['links', 'groups']) {
for (const key of ['links', 'reroutes', 'groups']) {
if (!_.isEqual(a[key], b[key])) {
return false
}