gun icon indicating copy to clipboard operation
gun copied to clipboard

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

Open ViteOrder opened this issue 3 years ago • 3 comments

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

ViteOrder avatar Nov 28 '22 23:11 ViteOrder

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

soulofmischief avatar Nov 30 '22 08:11 soulofmischief

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

amark avatar Dec 01 '22 05:12 amark

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

amark avatar Dec 16 '22 19:12 amark