Internal state transition to "inDOM" in Ember.CoreView causes 'You must use Ember.set() to access this property' error within ContainerView
I have an Ember Component that I'm passing to a ContainerView, and the Component is choking during render, throwing an error stating that you need to use Ember.set to set the view's state property. I'm not setting it directly, and it seems that the culprit is this line in Ember.CoreView.transitionTo (It's on line 24675 in Ember 1.4.0-b3.):
this.state = state;
Changing it to a simple this.set('state', state) seems to resolve the problem, but I'm not nearly comfortable enough with Ember internals to know whether this is an appropriate fix. I'd be happy to provide additional context if it helps. Thanks!
you are likely observing state, but it should not be observed.
We should consider making it _state
I am, in fact, observing state. :)
I have a "speech balloon" component that's intended to wrap a view and decorate it with a shadow and a little triangle, which is rendered in SVG. The thinking was that the size of the inner view would drive the size of the balloon, and thus a bunch of the SVG attributes are bound to computed properties that need to be able to call getBoundingClientRect() on the inner view's element. Naturally, this doesn't work too well if the inner view isn't in the DOM.
I was hoping to be able to get around this by having the computed properties just bail out if the inner view isn't in the DOM, and then have them recompute when the component state changes. Is there an alternative way I can accomplish this without dramatically restructuring things?
so, view.state isn't observable, we should likely consider moving it to _state although i suspect this will be a breaking change. Also this error message isn't very good, we should totally improve it.
I would be interested in a PR improving the error message.
@orochi235 as for the second question, stack-overflow is a much better venue for that sort of help, i suggest cross linking with this issue.