Logic behind observers on hasMany relationships


#1

I don’t understand exactly how (and when) are observers called on hasMany relationships.

Simple scenario. User has many tasks. When I have an observer on user.tasks it seems like it is fired too many times when doing user.set(‘tasks’, newTasks). It’s best for you to check out this twiddle:

https://ember-twiddle.com/b62bcd363507c63952f2a8c5072559b2?openFiles=templates.application.hbs%2C

Just click on “Set more tasks” button.

If somebody could explain the numbers (for each type of observer) I would be very grateful :slight_smile: With this kind of behaviour, observers on hasMany are practically unusable. Or maybe I’m doing something wrong?