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

Changing parent causes 'update' event for child, even if child value unchanged #455

Open
thomsbg opened this issue Aug 15, 2016 · 0 comments

Comments

@thomsbg
Copy link

thomsbg commented Aug 15, 2016

When setting a parent path, cursors of child paths are notified of 'update' events, even if the values at the child paths didn't change.

Repro steps:

var assert = require('assert')
var Baobab = require('baobab')
var tree = new Baobab({ outer: { inner: 'value' } })
tree.select('outer', 'inner').on('update', e => {
  // will fail
  assert.notEqual(e.data.previousData, e.data.currentData)
})
tree.set('outer', { inner: tree.get('outer', 'inner') })

Expected: the 'update' handler does not fire, since the value at path (outer, inner) did not change.
Actual: an AssertionError is thrown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant