minor refactoring and fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-03-26 01:10:32 +03:00
parent b5403e5542
commit 92c90fa466
3 changed files with 19 additions and 15 deletions

View File

@ -726,7 +726,7 @@ var CacheActions = actions.Actions({
// }) }], // }) }],
// //
cache: function(title, lister){ cache: function(title, lister){
if(!this.config.cache){ if(!(this.config || {}).cache){
return lister.call(this) return lister.call(this)
} }
var cache = this.__cache = this.__cache || {} var cache = this.__cache = this.__cache || {}

View File

@ -65,19 +65,18 @@ var StoreActions = actions.Actions({
// .stores_actions - dict of store-specific actions // .stores_actions - dict of store-specific actions
get stores(){ get stores(){
return this.cache('stores', function(d){ return this.cache('stores', function(d){
var res = {} return d ?
Object.assign({}, d)
this.actions.forEach(function(action){ : this.actions
var store = this.getActionAttr(action, 'handle_data_store') .reduce(function(res, action){
res[store] var store = this.getActionAttr(action, 'handle_data_store')
&& console.warn('Multiple handlers for store:', store) res[store]
if(store){ && console.warn('Multiple handlers for store:', store)
res[store] = action if(store){
} res[store] = action
}.bind(this)) }
return res
return res }.bind(this), {}) }) },
}) },
// events... // events...
// XXX update signature -- see doc for: .loadStore(..) // XXX update signature -- see doc for: .loadStore(..)

View File

@ -1949,12 +1949,17 @@ var BrowseActionsActions = actions.Actions({
getKeys('browseActions!: "'+ p +'"'), getKeys('browseActions!: "'+ p +'"'),
].filter(function(e){ return e.trim() != '' }).join(' / '), ].filter(function(e){ return e.trim() != '' }).join(' / '),
}, },
// hide dirs containing only hidden stuff...
// XXX this will only check statically hidden stuff... // XXX this will only check statically hidden stuff...
// ...the rest may still get dynamically hidden... // ...the rest may still get dynamically hidden...
hidden: options.no_hidden ? hidden: options.no_hidden ?
false false
// hide dirs containing only (statically)
// hidden items...
// NOTE: we are not checking browseMode
// of other items actively here at
// this point to avoid side-effects...
: Object.keys(cur[key]) : Object.keys(cur[key])
// XXX we still need to check browseMode of each child...
.filter(function(k){ .filter(function(k){
return (cur[key][k] || [])[1] != 'hidden' }) return (cur[key][k] || [])[1] != 'hidden' })
.length == 0, .length == 0,