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