diff --git a/browser.js b/browser.js index f6e0d5e..4ea60be 100755 --- a/browser.js +++ b/browser.js @@ -76,6 +76,13 @@ Promise.all([ store.update('Stores/IndexedDB', { __proto__: indexeddb.IndexedDBStore, }), + store.update('Stores/memory', { + __proto__: basestore.MetaStore, + data: { + '': {text: 'memory store'}, + moo: {text: 'moo'}, + }, + }), /*/ XXX next testing... store.next.update('NextPage', { diff --git a/pwiki/store/base.js b/pwiki/store/base.js index d14e8b7..3c77f2a 100755 --- a/pwiki/store/base.js +++ b/pwiki/store/base.js @@ -168,24 +168,15 @@ module.BaseStore = { .concat((!local && (this.next || {}).paths) ? this.next.paths() : []) }, - - // local names... - __names: cached('names', async function(){ - return this.__paths() + // XXX BUG: after caching this will ignore the local argument.... + names: cached('names', async function(local=false){ + return this.paths(local) .iter() .reduce(function(res, path){ var n = pwpath.basename(path) if(!n.includes('*')){ (res[n] = res[n] ?? []).push(path) } return res }, {}) }), - // XXX should this also be cached??? - names: async function(local=false){ - return { - ...(!local && (this.next || {}).names ? - await this.next.names() - : {}), - ...await this.__names(), - } }, // XXX sort paths based on search order into three groups: // - non-system @@ -713,18 +704,6 @@ module.MetaStore = { return object.parentCall(MetaStore.paths, this, ...arguments) .iter() .concat(stores) }, - names: async function(){ - var that = this - var res = await object.parentCall(MetaStore.names, this, ...arguments) - await Promise.all(Object.entries(this.substores ?? {}) - .map(async function([path, store]){ - return Object.entries(await store.names()) - .map(function([name, paths]){ - res[name] = (res[name] ?? []) - .concat(paths - .map(function(s){ - return pwpath.join(path, s) })) }) })) - return res }, exists: metaProxy('exists', //async function(path){ diff --git a/pwiki2.js b/pwiki2.js index 181d631..f98d346 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -17,12 +17,8 @@ * - CLI * * -* XXX BUG: can't .get(..) data from substore root... -* ...updating it seems to work fine... -* XXX IndexedDB: after editing a page for some reason we do not see the -* final version until a full refresh -- cache??? -* ...this seems to disappeared after moving external stores -* from / to /Stores... +* XXX BUG: when editing the root page of a substore the page's .cache is +* not reset for some reason... * XXX Chrome started spamming CORS error: * Access to manifest at 'file:///L:/work/pWiki/manifest.json' * from origin 'null' ...