mirror of
https://github.com/urbit/shrub.git
synced 2024-12-14 20:02:51 +03:00
actually fix EMPTY usage
This commit is contained in:
parent
b07f6fab02
commit
cdad444127
@ -1693,8 +1693,10 @@ TreeStore = _.extend(EventEmitter.prototype, {
|
|||||||
return this.fulfillAt(this.getTree(path.split('/')), path, query);
|
return this.fulfillAt(this.getTree(path.split('/')), path, query);
|
||||||
},
|
},
|
||||||
fulfillAt: function(tree, path, query) {
|
fulfillAt: function(tree, path, query) {
|
||||||
var data, k, ref, sub, t;
|
var data, have, k, sub, t;
|
||||||
data = this.fulfillLocal(path, query);
|
data = this.fulfillLocal(path, query);
|
||||||
|
have = _data[path];
|
||||||
|
if (have != null) {
|
||||||
for (k in query) {
|
for (k in query) {
|
||||||
t = query[k];
|
t = query[k];
|
||||||
if (!QUERIES[k]) {
|
if (!QUERIES[k]) {
|
||||||
@ -1703,15 +1705,16 @@ TreeStore = _.extend(EventEmitter.prototype, {
|
|||||||
if (t !== QUERIES[k]) {
|
if (t !== QUERIES[k]) {
|
||||||
throw TypeError("Wrong query type: " + k + ", '" + t + "'");
|
throw TypeError("Wrong query type: " + k + ", '" + t + "'");
|
||||||
}
|
}
|
||||||
data[k] = (ref = _data[path]) != null ? ref[k] : void 0;
|
data[k] = have[k];
|
||||||
}
|
}
|
||||||
if (query.kids && !_data[path].EMPTY) {
|
if (query.kids && !have.EMPTY) {
|
||||||
data.kids = {};
|
data.kids = {};
|
||||||
for (k in tree) {
|
for (k in tree) {
|
||||||
sub = tree[k];
|
sub = tree[k];
|
||||||
data.kids[k] = this.fulfillAt(sub, path + "/" + k, query.kids);
|
data.kids[k] = this.fulfillAt(sub, path + "/" + k, query.kids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!_.isEmpty(data)) {
|
if (!_.isEmpty(data)) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,12 @@ TreeStore = _.extend EventEmitter.prototype, {
|
|||||||
fulfill: (path,query) -> @fulfillAt (@getTree path.split '/'),path,query
|
fulfill: (path,query) -> @fulfillAt (@getTree path.split '/'),path,query
|
||||||
fulfillAt: (tree,path,query)->
|
fulfillAt: (tree,path,query)->
|
||||||
data = @fulfillLocal path, query
|
data = @fulfillLocal path, query
|
||||||
|
have = _data[path]
|
||||||
|
if have?
|
||||||
for k,t of query when QUERIES[k]
|
for k,t of query when QUERIES[k]
|
||||||
if t isnt QUERIES[k] then throw TypeError "Wrong query type: #{k}, '#{t}'"
|
if t isnt QUERIES[k] then throw TypeError "Wrong query type: #{k}, '#{t}'"
|
||||||
data[k] = _data[path]?[k]
|
data[k] = have[k]
|
||||||
if query.kids and not _data[path]?.EMPTY
|
if query.kids and not have.EMPTY
|
||||||
data.kids = {}
|
data.kids = {}
|
||||||
for k,sub of tree
|
for k,sub of tree
|
||||||
data.kids[k] = @fulfillAt sub, path+"/"+k, query.kids
|
data.kids[k] = @fulfillAt sub, path+"/"+k, query.kids
|
||||||
|
Loading…
Reference in New Issue
Block a user