Setting a property only once (in an observer) throws Deprecation Warning You modified X twice in a single render

Hi,

I am running into quite some peculiar behavior. The thing is I understand the deprecation warning, however, it should not be happening as an ‘observes’, IMHO, does not use a getter, so, setting a property should not cause the deprecation.

I am using Ember 2.2.0 and Ember-Cli 1.13.8. Everything is structured in Components and, if need be, Services (global singletons). Here’s a simplified version of my code. I should maybe make a JSFiddle and try to reproduce it, but I figured someone might spot the error directly.

Parent component template:

{{my-component model=service.currentModel changed=changed}}

my-component.js:

watchChanged: function() {
    this.set('model', this.get('some_internal_value')); //this throws deprecation, even though it should not
    this.get('parentView').send('resetChanged'); // reset changed in the parent
}.observes('changed', 'some_internal_value')

I went with the debugger and watchChanged is called EXACTLY ONCE, in spite of this fact, the deprecation warning is thrown. The code works perfectly, save for the deprecation warning. Any ideas?

My workaround is to do the set as a task in the ‘afterRender’ queue, but this isn’t a solution for the issues that I am experiencing.

What is the ember-way in this case? Is it a bug or a lack of understanding on my side?

Edit x1: There are no didInsertElement/willInsertElement hooks implemented in the parent, nor in the child. I assume that the service querying is somehow causing it… but I do not have enough experience with services to say for sure.

For reference: cross-posted it here.

wrap your observers on run loop…