When gun storage is disable gun doesnt trigger on events.
I have tested the code with node (v14.18.2), not sure if browser has the same behavior.
The following code:
const GUN = require('gun');
const gun = GUN({localStorage: false, radisk: false});
const alice = gun.get('alice').put({name: 'alice'});
const bob = gun.get('bob').put({name: 'bob'});
const users = gun.get('users');
users.map().on(user => console.log(user));
users.set(alice)
users.set(bob);
alice.get('friends').map().on((friend, k) => console.log("Alice Friend", friend, k));
alice.get('friends').set(bob);
alice.get('friends').set(alice);
Will fire on event here users.map().on(user => console.log(user));
But it will not fire on events here alice.get('friends').map().on((friend, k) => console.log("Alice Friend", friend, k));
So it seems that deep is also related to the bug.
Now the working version of code would be like this:
const GUN = require('gun');
const gun = GUN();
const alice = gun.get('alice').put({name: 'alice'});
const bob = gun.get('bob').put({name: 'bob'});
const users = gun.get('users');
users.map().on(user => console.log(user));
users.set(alice)
users.set(bob);
alice.get('friends').map().on((friend, k) => console.log("Alice Friend", friend, k));
alice.get('friends').set(bob);
alice.get('friends').set(alice);
This will fire users on event and alice friends on event, the difference is on GUN() "constructor" that will create default storage, on my case running node it will create radisk.
I have talked with @amark and he says its probably a bug, because Gun should be able to work with no storage so only in memory.
👍 .
Anyone want to tackle this?