# Need help migrating from CanJS 2.2 to 2.3 - attrs and in bind change not syncing in views

**URL:** <https://forums.bitovi.com/t/need-help-migrating-from-canjs-2-2-to-2-3-attrs-and-in-bind-change-not-syncing-in-views/795>\
**Category:** CanJS\
**Created:** [January 18, 2018, 10:44pm UTC](https://forums.bitovi.com/t/need-help-migrating-from-canjs-2-2-to-2-3-attrs-and-in-bind-change-not-syncing-in-views/795 "2018-01-18T22:44:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![theycallmethesloth](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@theycallmethesloth](https://forums.bitovi.com/u/theycallmethesloth)\
**Post date:** [January 18, 2018, 10:44pm UTC](https://forums.bitovi.com/t/need-help-migrating-from-canjs-2-2-to-2-3-attrs-and-in-bind-change-not-syncing-in-views/795/1 "2018-01-18T22:44:06Z")

</div>

We at atVenu (Hi @daffl - remember Calgary? 😀) are trying to migrate from CanJS 2.2 to CanJS 2.3 because we upgraded jQuery from 1.11 to 1.12.

We are trying to do the minimum, and landed on 2.3.11 because it seems to have the least differences - until now.

We are having a heck of a time getting our Mustache views to update when we change attrs in the bind change event. This worked fine in CanJS 2.2, but is broken in CanJS 2.3.11 and 2.3.28.

Here is a working example in CanJS 2.2 [https://jsbin.com/juqitiyuma/1/edit?html,js,output](https://jsbin.com/juqitiyuma/1/edit?html,js,output)  
If the value of box is ‘no’ then you cannot check the flag. The change handler resets it back to false.

Here is a broken example in CanJS 2.3.28 [https://jsbin.com/beheqotako/1/edit?html,js,output](https://jsbin.com/beheqotako/1/edit?html,js,output)  
If the value of box is ‘no’ then you can check the flag once and then the view gets stuck in the True state (when it should be False). The attr in the model may actually be false - but it is out of sync.

Any help on this would be appreciated.  
Thanks,  
=Blair

---

<div class="post-metadata">

**Author:** ![justinbmeyer](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/justinbmeyer/32/179_2.png) [@justinbmeyer](https://forums.bitovi.com/u/justinbmeyer)\
**Post date:** [January 18, 2018, 11:32pm UTC](https://forums.bitovi.com/t/need-help-migrating-from-canjs-2-2-to-2-3-attrs-and-in-bind-change-not-syncing-in-views/795/2 "2018-01-18T23:32:55Z")

</div>

Could you do it in a set timeout like I’ve done here: [https://jsbin.com/beheqotako/1/edit?html,js,output](https://jsbin.com/beheqotako/1/edit?html,js,output)

2.3 and prior had a batching system that would break under certain circumstances. This is almost certainly one of those circumstances. Setting a timeout always makes sure new changes will run within a new batch.

---

<div class="post-metadata">

**Author:** ![theycallmethesloth](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@theycallmethesloth](https://forums.bitovi.com/u/theycallmethesloth)\
**Post date:** [January 18, 2018, 11:36pm UTC](https://forums.bitovi.com/t/need-help-migrating-from-canjs-2-2-to-2-3-attrs-and-in-bind-change-not-syncing-in-views/795/3 "2018-01-18T23:36:31Z")

</div>

Thanks for the reply,

I think the jsbin you mention needs to be saved or cloned and given a new URL, because the one you pasted seems to be my original broken one.

Thanks,  
=B

---

<div class="post-metadata">

**Author:** ![justinbmeyer](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/justinbmeyer/32/179_2.png) [@justinbmeyer](https://forums.bitovi.com/u/justinbmeyer)\
**Post date:** [January 18, 2018, 11:37pm UTC](https://forums.bitovi.com/t/need-help-migrating-from-canjs-2-2-to-2-3-attrs-and-in-bind-change-not-syncing-in-views/795/4 "2018-01-18T23:37:17Z")

</div>

> **[JS Bin](https://jsbin.com/foxedic/1/edit?html,js,output)**
>
> A live pastebin for HTML, CSS & JavaScript and a range of processors, including SCSS, CoffeeScript, Jade and more...

```auto
bob.bind('change', function(event, identifier, type) {
  setTimeout(function(){
    console.log(arguments)
    if (type == 'set' && !event.batchNum) {
      flag = bob.attr('flag');
      box = bob.attr('box');
    
      if (flag && box === 'no') {
        bob.attr('flag', false)
      }
  
      // Save Changes to Server...
      }
    },1);
  
  
});

```

---

<div class="post-metadata">

**Author:** ![theycallmethesloth](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@theycallmethesloth](https://forums.bitovi.com/u/theycallmethesloth)\
**Post date:** [January 18, 2018, 11:45pm UTC](https://forums.bitovi.com/t/need-help-migrating-from-canjs-2-2-to-2-3-attrs-and-in-bind-change-not-syncing-in-views/795/5 "2018-01-18T23:45:00Z")

</div>

Thanks Justin,

I will give it a try.

=B

---

<div class="post-metadata">

**Author:** ![theycallmethesloth](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@theycallmethesloth](https://forums.bitovi.com/u/theycallmethesloth)\
**Post date:** [January 19, 2018, 4:59pm UTC](https://forums.bitovi.com/t/need-help-migrating-from-canjs-2-2-to-2-3-attrs-and-in-bind-change-not-syncing-in-views/795/6 "2018-01-19T16:59:38Z")

</div>

Thanks Justin,

Your advice is fixing the issue.

=B
