Added navigation to top/bottom, normalized toplevel node parent to root node

This commit is contained in:
Magnus Åhall 2025-02-09 11:14:26 +01:00
parent 8192f49558
commit e276e6d156
3 changed files with 54 additions and 11 deletions

View file

@ -336,7 +336,13 @@ export class Node {
this.data = nodeData
this.UUID = nodeData.UUID
this.ParentUUID = nodeData.ParentUUID
// Toplevel nodes are normalized to have the ROOT_NODE as parent.
if (nodeData.UUID !== ROOT_NODE && nodeData.ParentUUID === '') {
this.ParentUUID = ROOT_NODE
this.data.ParentUUID = ROOT_NODE
} else
this.ParentUUID = nodeData.ParentUUID
this._children_fetched = false
this.Children = []