amark / gun

An open source cybersecurity protocol for syncing decentralized graph data.
https://gun.eco/docs
Other
17.96k stars 1.16k forks source link

`put` ignores all nested variables if one of them is an empty object #1294

Open ViteOrder opened 1 year ago

ViteOrder commented 1 year ago

https://jsbin.com/raleguqaca/1/edit?js,console

gun.get('layer0').put({
  value: true,
  emptyObject: {},
  layer1: {
    value: false, 
    value2: false,
    layer2: {a:1}
  }
})

gun.get('layer0').get('layer1').once(print)

everything in layer1 wont get added because of the empty object. The once statement will only print undefined

soulofmischief commented 1 year ago

I am also experiencing this. For now, I am having to remove empty fields and then rehydrate on once/load. It's not ideal.

amark commented 1 year ago

utoh! Thanks for finding. Can work around in meanwhile???

amark commented 1 year ago

Hmm, this might be related to https://github.com/amark/gun/issues/1295 actually, and if so... is immediately now highest priority.