Why can’t I reset a property containing an array in the willDestroy hook of an ember object instance?
You’ve been trolled by a long discussed issue: https://github.com/emberjs/ember.js/issues/462
The fix: http://jsfiddle.net/fqbrL0gb/3/
If you’re really after the shared instance of array across instances of this type, then: http://jsfiddle.net/fqbrL0gb/4/ but it’s probably more appropriate to make it a class property to avoid confusion in the future. Something like: http://jsfiddle.net/2jmab8px/1/
Thanks for the link that issue makes sense, but why doesn’t the array get set in willDestroy? This seems like a bug, if I can set the property on init why not on destroy isn’t that the main use case for the willDestroy hook?
I’m not really sure why that is happening, but I’m curious what the usecase of changing a prop on an instance that is about to be destroyed? My guess is it’s a timing thing within the run loop.