mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 18:10:09 +00:00
reworked .names() and some fixes and tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
498536695f
commit
71be07be39
@ -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', {
|
||||
|
||||
@ -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){
|
||||
|
||||
@ -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' ...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user