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

@ -222,11 +222,9 @@ export class NodeStore {
}//}}}
async getTreeNodes(parent, newLevel) {//{{{
return new Promise((resolve, reject) => {
// Parent of toplevel nodes is '' in indexedDB,
// but can also be set to the ROOT_NODE uuid.
// Parent of toplevel nodes is ROOT_NODE in indexedDB.
// Only the root node has '' as parent.
let storeParent = parent
if (parent === ROOT_NODE)
storeParent = ''
const trx = this.db.transaction('nodes', 'readonly')
const nodeStore = trx.objectStore('nodes')
@ -305,7 +303,7 @@ export class NodeStore {
.transaction('nodes', 'readonly')
.objectStore('nodes')
if (node.ParentUUID === '') {
if (node.ParentUUID === ROOT_NODE) {
resolve(accumulated)
return
}