diff --git a/gun.js b/gun.js index 76e0348c..7318b538 100644 --- a/gun.js +++ b/gun.js @@ -691,8 +691,9 @@ if(!cat.soul && !msg.$$){ if( (cat.link !== null || (root.pass||'')[cat.id]) && - //cat.link !== u && // TODO: BUG? actually this should be if link as a property exists or not. + (((root.pass||'')[cat.id] && cat.link !== u && cat.ask['']) || // fire again if we have a pass but be careful not to fire if we do not have the node fully loaded yet. (('string' != typeof (tmp = valid(change))) || (cat.link && tmp != cat.link)) // any time there is a change in value that is different from the previous link in any way, we need to fire a clear/empty event on chains below. // However! Do this only when unique, and make sure to do it with performance in mind. + ) ){ cat.link = null; cat.next && setTimeout.each(Object.keys(cat.ask||''), function(get, sat){ // TODO: Bug? If we're a map do we want to clear out everything, wouldn't it just be the one item's subchains, not all? diff --git a/test/common.js b/test/common.js index db859b2e..c98f2fcb 100644 --- a/test/common.js +++ b/test/common.js @@ -2937,14 +2937,15 @@ describe('Gun', function(){ }, 'parallel', function(){ gun.get('parallel').get('bob').get('age').get(function(at, ev){ var err = at.err, data = at.put, field = at.get; - //console.log("***** age", data, field, at.$._.ack, '...', at);//return; + //console.log("*****", field, data);return; expect(data).to.be(29); expect(field).to.be('age'); done.age = true; }); + //console.log("-----------------------"); gun.get('parallel').get('bob').get('name').get(function(at, ev){ var err = at.err, data = at.put, field = at.get; - //console.log("*********** name", data, at.$._.ack);//return; + //console.log("***********", field, data);return; expect(data).to.be('Bob!'); expect(field).to.be('name'); done.name = true; @@ -3530,7 +3531,7 @@ describe('Gun', function(){ }, 1000); }); - it.only('Chain on known nested object should ack', function(done){ + it('Chain on known nested object should ack', function(done){ Gun.statedisk({ bar: { wat: 1 } }, 'nl/app', function(){ var gun = Gun(), u; var app = gun.get('nl/app').get('bar'); @@ -3538,7 +3539,7 @@ describe('Gun', function(){ app.get(function(d){ //d = (d.$$||d.$)._.put; if(!d || !d.put || !d.put.wat){ return } - console.log('should be called: {wat:1}=', d.put); + //console.log('should be called: {wat:1}=', d.put); expect(d.put.wat).to.be(1); done.a = 1; if(!done.u){ return } @@ -3547,9 +3548,9 @@ describe('Gun', function(){ done(); });//, {v2020:1}); - console.log("----------"); + //console.log("----------"); app.get('a').get('b').get(function(d){ - console.log("empty/clear: undefined=", d.put); + //console.log("empty/clear: undefined=", d.put); //d = (d.$$||d.$)._.put; expect(d.put).to.be(u); done.u = true; @@ -3580,7 +3581,7 @@ describe('Gun', function(){ }); - it('users map map who said map on', function(done){ + it.only('users map map who said map on', function(done){ this.timeout(1000 * 9); var gun = Gun();