mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-11 16:09:31 +03:00
Merge branch 'bvschwartz-patch-1', remote-tracking branch 'anton/nobreach' into pending
This commit is contained in:
commit
29835e1fe0
@ -277,7 +277,7 @@ referentially transparent manner.
|
||||
A `%next` request checks query at the given revision, and it
|
||||
produces the result of the query the next time it changes, along
|
||||
with the revsion number when it changes. Thus, a `%next` of a
|
||||
`%u` is triggered when a file is added or deleted, a `%next of a
|
||||
`%u` is triggered when a file is added or deleted, a `%next` of a
|
||||
`%x` is triggered when a file is added, deleted, or changed, and
|
||||
a `%next` of a `%y` is triggered when a file or any of its
|
||||
children is added, deleted, or changed.
|
||||
|
@ -36,8 +36,8 @@ module.exports = (queries, Child, load=_load)-> recl
|
||||
request = {}
|
||||
for k of _queries when k isnt 'kids'
|
||||
request[k] = _queries[k] unless have[k] isnt undefined
|
||||
if _queries.kids? and have.kids?
|
||||
if _.isEmpty have.kids
|
||||
if _queries.kids?
|
||||
if not have.kids?
|
||||
request.kids = _queries.kids
|
||||
else
|
||||
request.kids = {}
|
||||
|
@ -356,8 +356,8 @@ module.exports = function(queries, Child, load) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((_queries.kids != null) && (have.kids != null)) {
|
||||
if (_.isEmpty(have.kids)) {
|
||||
if (_queries.kids != null) {
|
||||
if (have.kids == null) {
|
||||
request.kids = _queries.kids;
|
||||
} else {
|
||||
request.kids = {};
|
||||
@ -1603,6 +1603,10 @@ var invariant = function(condition, format, a, b, c, d, e, f) {
|
||||
module.exports = invariant;
|
||||
|
||||
},{}],20:[function(require,module,exports){
|
||||
var dedup;
|
||||
|
||||
dedup = {};
|
||||
|
||||
module.exports = {
|
||||
get: function(path, query, cb) {
|
||||
var url;
|
||||
@ -1610,6 +1614,10 @@ module.exports = {
|
||||
query = "no-query";
|
||||
}
|
||||
url = (window.tree.basepath(path)) + ".json?q=" + (this.encode(query));
|
||||
if (dedup[url]) {
|
||||
return;
|
||||
}
|
||||
dedup[url] = true;
|
||||
return $.get(url, {}, function(data) {
|
||||
if (cb) {
|
||||
return cb(null, data);
|
||||
@ -1707,11 +1715,17 @@ TreeStore = _.extend(EventEmitter.prototype, {
|
||||
}
|
||||
data[k] = have[k];
|
||||
}
|
||||
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 (query.kids) {
|
||||
if (have.EMPTY) {
|
||||
data.kids = {};
|
||||
} else {
|
||||
for (k in tree) {
|
||||
sub = tree[k];
|
||||
if (data.kids == null) {
|
||||
data.kids = {};
|
||||
}
|
||||
data.kids[k] = this.fulfillAt(sub, path + "/" + k, query.kids);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
dedup = {} # XX wrong layer
|
||||
module.exports =
|
||||
get: (path,query="no-query",cb) ->
|
||||
url = "#{window.tree.basepath(path)}.json?q=#{@encode query}"
|
||||
return if dedup[url]
|
||||
dedup[url] = true
|
||||
$.get url, {}, (data) -> if cb then cb null,data
|
||||
encode: (obj)->
|
||||
delim = (n)-> Array(n+1).join('_') || '.'
|
||||
|
@ -26,9 +26,11 @@ 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] = have[k]
|
||||
if query.kids and not have.EMPTY
|
||||
data.kids = {}
|
||||
for k,sub of tree
|
||||
if query.kids
|
||||
if have.EMPTY
|
||||
data.kids = {}
|
||||
else for k,sub of tree
|
||||
data.kids ?= {}
|
||||
data.kids[k] = @fulfillAt sub, path+"/"+k, query.kids
|
||||
data unless _.isEmpty data
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user