This commit is contained in:
Mark Nadal 2017-01-29 00:04:37 -08:00
parent b03f6e0de8
commit 122890b42d
3 changed files with 27 additions and 14 deletions

20
gun.js
View File

@ -1323,11 +1323,12 @@
(gun._).put = cat.put;
}
}
/*
if(cat.put && (tmp = at.put) && tmp[rel._] && rel.is(tmp)){ // an uglier but faster way for checking if it is not a relation, but slower if it is.
return ev.to.next(at); // For a field that has a relation we want to proxy, if we have already received an update via the proxy then we can deduplicate the update from the field.
at = obj_to(at, {put: cat.put});
//return ev.to.next(at); // For a field that has a relation we want to proxy, if we have already received an update via the proxy then we can deduplicate the update from the field.
}
/*
/*
//console.debug.i && console.log("????", cat.put, u === cat.put, at.put);
if(u === cat.put && u !== at.put){ // TODO: Use state instead?
return ev.to.next(at); // For a field that has a value, but nothing on its context, then that means we have received the update out of order and we will receive it from the context, so we can deduplicate this one.
@ -1620,7 +1621,7 @@
//if(cat.put !== u){ return }
cat.on('in', {
get: cat.get,
put: cat.put,
put: cat.put = u,
gun: gun,
via: at
})
@ -1983,15 +1984,12 @@
;require(function(module){
var Gun = require('./core');
Gun.chain.not = function(cb, opt, t){
var gun = this, at = Gun.obj.to(gun._, {not: {not: cb}});
gun.get(ought, {as: at});
return gun;
return this.get(ought, {not: cb});
}
function ought(cat, ev){ ev.off(); var at = this; // TODO: BUG! Is this correct?
if(cat.err || cat.put){ return }
if(!at.not || !at.not.not){ return }
//ev.stun(); // TODO: BUG? I think this is correct. NOW INCORRECT because as things mutate we might want to retrigger!
at.not.not.call(at.gun, at.get, function(){ console.log("Please report this bug on https://gitter.im/amark/gun and in the issues."); need.to.implement; });
function ought(at, ev){ ev.off();
if(at.err || at.put){ return }
if(!this.not){ return }
this.not.call(at.gun, at.get, function(){ console.log("Please report this bug on https://gitter.im/amark/gun and in the issues."); need.to.implement; });
}
})(require, './not');

View File

@ -1,6 +1,6 @@
{
"name": "gun",
"version": "0.5.1",
"version": "0.5.2",
"description": "Graph engine",
"main": "index.js",
"scripts": {

View File

@ -2969,16 +2969,31 @@ describe('Gun', function(){
parent.path('sub').on(function(data){
//console.log("sub", data);
done.sub = data;
});
child.on(function(data){
done.child = data;
//console.log("child", data);
})
parent.val(function(data){
});
parent.on(function(data){
done.parent = data;
//console.log("parent", data);
done(); // TODO: Add more meaningful checks!
});
});
it('empty val followed', function(done){
var gun = Gun();
gun.get('val/follow').val(function(){
//console.log("val");
}).get(function(){
//console.log("got");
done();
});
});
it('get get get any parallel', function(done){
var s = Gun.state.map();s.soul = 'parallel';
Gun.on('put', {gun: gun, put: Gun.graph.ify({