forked from platypush/platypush
Don't load entities that only have non-queriable children
This commit is contained in:
parent
2778357a9e
commit
afd9a1d6bf
1 changed files with 18 additions and 1 deletions
|
@ -177,6 +177,23 @@ export default {
|
|||
}, {})
|
||||
},
|
||||
|
||||
_shouldSkipLoading(entity) {
|
||||
const children = Object.values(this.childrenByParentId(entity.id))
|
||||
const hasReadableChildren = children.filter((child) => {
|
||||
return (
|
||||
!child.is_configuration &&
|
||||
!child.is_write_only &&
|
||||
!child.is_query_disabled
|
||||
)
|
||||
}).length > 0
|
||||
|
||||
return (
|
||||
entity.is_query_disabled ||
|
||||
entity.is_write_only ||
|
||||
(children.length && !hasReadableChildren)
|
||||
)
|
||||
},
|
||||
|
||||
async refresh(group) {
|
||||
const entities = (group ? group.entities : this.entities) || {}
|
||||
const args = {}
|
||||
|
@ -187,7 +204,7 @@ export default {
|
|||
}, {}))
|
||||
|
||||
this.loadingEntities = Object.values(entities).reduce((obj, entity) => {
|
||||
if (entity.is_query_disabled || entity.is_write_only)
|
||||
if (this._shouldSkipLoading(entity))
|
||||
return obj
|
||||
|
||||
const self = this
|
||||
|
|
Loading…
Reference in a new issue