From aaba53d2fad7e8cbcdd43574dd78f784aba6d3ef Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Wed, 23 Sep 2015 16:29:20 -0700 Subject: [PATCH] better emptiness handling take 2 --- pub/tree/src/js/main.js | 4 ++-- pub/tree/src/js/stores/TreeStore.coffee | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pub/tree/src/js/main.js b/pub/tree/src/js/main.js index 01394d57c..8777afb83 100644 --- a/pub/tree/src/js/main.js +++ b/pub/tree/src/js/main.js @@ -1705,7 +1705,7 @@ TreeStore = _.extend(EventEmitter.prototype, { } data[k] = (ref = _data[path]) != null ? ref[k] : void 0; } - if (query.kids && !_data.EMPTY) { + if (query.kids && !_data[path].EMPTY) { data.kids = {}; for (k in tree) { sub = tree[k]; @@ -1762,7 +1762,7 @@ TreeStore = _.extend(EventEmitter.prototype, { this.loadValues(tree[k], path + "/" + k, v); } if (data.kids && _.isEmpty(data.kids)) { - _data.EMPTY = true; + old.EMPTY = true; old.body = { gn: 'div', c: [ diff --git a/pub/tree/src/js/stores/TreeStore.coffee b/pub/tree/src/js/stores/TreeStore.coffee index fab973dfe..ee24ea092 100644 --- a/pub/tree/src/js/stores/TreeStore.coffee +++ b/pub/tree/src/js/stores/TreeStore.coffee @@ -24,7 +24,7 @@ TreeStore = _.extend EventEmitter.prototype, { for k,t of query when QUERIES[k] if t isnt QUERIES[k] then throw TypeError "Wrong query type: #{k}, '#{t}'" data[k] = _data[path]?[k] - if query.kids and not _data.EMPTY + if query.kids and not _data[path].EMPTY data.kids = {} for k,sub of tree data.kids[k] = @fulfillAt sub, path+"/"+k, query.kids @@ -54,7 +54,7 @@ TreeStore = _.extend EventEmitter.prototype, { @loadValues tree[k], path+"/"+k, v if data.kids && _.isEmpty data.kids - _data.EMPTY = true + old.EMPTY = true old.body = gn: 'div' c: [ {gn:'h1', ga:{className:'error'}, c:['Error: Empty path']}