Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep async changes not updating #167

Closed
PsychoLlama opened this issue Feb 10, 2016 · 1 comment
Closed

Deep async changes not updating #167

PsychoLlama opened this issue Feb 10, 2016 · 1 comment

Comments

@PsychoLlama
Copy link
Contributor

When asynchronously updating deeply nested data in gun, the updates won't propagate, and nothing will get the new data (including the underlying data stores).

It's an oddly specific bug, though...

  • updates must be at nested at least three layers deep, or gun will notice
  • it must be asynchronous, or else gun will get the update

Here's something that could be adapted to a jasmine/mocha test case:

// object nested three layers deep
// must be at least three layers
var obj = { 1: { 1: { data: false } } }

// define gun and place the deep object
gun = Gun().get('deep change').put(obj)

// listen for changes
gun.path('1.1.data').on(function (data) {
  if (data) {
    // gun will never receive the "true" update
  }
})

// asynchronously set data
// synchronous deviations will succeed
setTimeout(function () {
  obj[1][1].data = true
  gun.put(obj)
}, 50)
@amark
Copy link
Owner

amark commented Feb 20, 2017

WOOOHOOO fixed: http://jsbin.com/gijaxeqana/edit?js,console with all the latest 0.5+ (now on 0.6) major improvements. Closing. :D

@amark amark closed this as completed Feb 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants