More caching, first tree navigation with up/down.

This commit is contained in:
Magnus Åhall 2025-02-06 22:31:11 +01:00
parent 0bd5d08edf
commit 82f09dcb1d
8 changed files with 317 additions and 151 deletions

View file

@ -222,10 +222,16 @@ 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.
let storeParent = parent
if (parent === ROOT_NODE)
storeParent = ''
const trx = this.db.transaction('nodes', 'readonly')
const nodeStore = trx.objectStore('nodes')
const index = nodeStore.index('byParent')
const req = index.getAll(parent)
const req = index.getAll(storeParent)
req.onsuccess = (event) => {
const nodes = []
for (const i in event.target.result) {