Gun Version 0.9.99997
const gun = new Gun();
gun.get('key').put({property: 'value'});
/*
output:
{property: "value"}
{property: "newValue"}
*/
gun.get('key').on(function (data, key) {
console.log('1', data);
});
/*
output:
{property: "value"}
*/
gun.get('key').on(function (data, key) {
console.log('2', data);
});
setTimeout(() => {
gun.get('key').put({property: 'newValue'});
}, 1000);
The first time both subscriptions are updated, but with the following changes only the first one is updated.
@ivkan wowowow this is bad bad bad. CONFIRMED.
Thank you SO much.
Sorry for such a super late reply, November was a cargo train of busy.
I'll be adding your code as a core test to GUN.
Have you been able to make progress / work around in the meanwhile?
This might also be causing the error in https://github.com/amark/gun/issues/649
Thanks for the answer! For some time I tried to figure it out on my own, but I failed.
When it turns out to fix this problem, I will continue to work on my Gun's adapter for Angular. Subscription in several places is very important for large applications.
@ivkan right, I instantly thought of all the current UI extensions (including my own! Which last time I checked worked, but that was months ago) that would break as a result of this. Very good/important find.
@ivkan test added, bug fixed in latest local commit, expect it to be published next week or earlier.
THANK YOU FOR FINDING THIS... really an embarrassing bug. I think it impacts several other issues reported.
Fix should be published now, it uses the test you provided. Thank you! Closing.
Most helpful comment
@ivkan test added, bug fixed in latest local commit, expect it to be published next week or earlier.
THANK YOU FOR FINDING THIS... really an embarrassing bug. I think it impacts several other issues reported.