{"action":"opened","issue":{"url":"https://api.github.com/repos/Yomguithereal/baobab/issues/141","labels_url":"https://api.github.com/repos/Yomguithereal/baobab/issues/141/labels{/name}","comments_url":"https://api.github.com/repos/Yomguithereal/baobab/issues/141/comments","events_url":"https://api.github.com/repos/Yomguithereal/baobab/issues/141/events","html_url":"https://github.com/Yomguithereal/baobab/issues/141","id":63839094,"number":141,"title":"Synchronous updates sticking around causing infinite loop","user":{"login":"jmisterka","id":8105054,"avatar_url":"https://avatars.githubusercontent.com/u/8105054?v=3","gravatar_id":"","url":"https://api.github.com/users/jmisterka","html_url":"https://github.com/jmisterka","followers_url":"https://api.github.com/users/jmisterka/followers","following_url":"https://api.github.com/users/jmisterka/following{/other_user}","gists_url":"https://api.github.com/users/jmisterka/gists{/gist_id}","starred_url":"https://api.github.com/users/jmisterka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmisterka/subscriptions","organizations_url":"https://api.github.com/users/jmisterka/orgs","repos_url":"https://api.github.com/users/jmisterka/repos","events_url":"https://api.github.com/users/jmisterka/events{/privacy}","received_events_url":"https://api.github.com/users/jmisterka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-23T21:41:52Z","updated_at":"2015-03-23T21:41:52Z","closed_at":null,"body":"Baobab is in synchronous mode with autoCommit=true and I'm using a change in the model to inform a change to the view.\r\n\r\nUsing the example below when I update model.pickup and internally baobab commits the change and updates any listeners, but this happens before it clears this._futureUpdate.\r\n\r\nThe update event triggers the action to change the view. Baobab again commits the change but this time this._futureUpdate isn't empty and is merged in causing it to update view and model.pickup together. \r\n\r\nSo, model.pickup is updated twice and continues to be because the listener keeps getting hit with the update event causing an infinite loop.\r\n\r\nexampleTree = new Baobab({\r\n  model: {\r\n    pickup: 'paris'\r\n },\r\n  view: 'pickup'\r\n})\r\n\r\nexampleTree.select(['model', 'pickup']).on('update', (updateObj) => {\r\n  actions.setView('dropoff'); // imagine this uses an actions file that set's view to 'dropoff' on tree\r\n});\r\n\r\nIt seems to me that for synchronous operation this._futureUpdate should be cleared before the update event is sent so previous synchronously committed changes aren't committed twice."}}