Closed Awem closed 8 years ago
Hmm. Interesting edge case. I'll have to look into the view select source to see how they manage it. Funny, you'd think Ember.Object
s would handle promises intrinsically.
The way ManyArray works has changed in Ember Data.
For example, {{select-picker content=model.items.content ...}}
used to work, but now you have to invoke .toArray()
on model.items. I just made a computed property in my component that returns model.items.toArray()
, so I can just do {{select-picker content=items ...}}
See also https://github.com/emberjs/data/issues/3604#issuecomment-125782623
I ran into a gotcha with PromiseProxyMixin. If you pass the component as the value another promise resolves to the RSVP lib will resolve to the content of the component not the component itself. PromiseProxyMixin can be quite magical this way.
There be dragons here. :dragon:
Closing due to atrophy. Reopen if needed.
I think that resolving a promise should not be this addon's responsibility. The contract is that whatever is bound to content
should be an array of select-picker objects. I recommend using a computed property that is dependent on the promise resolution.
select-picker
seems to handle theselection
attribute differently thenview 'select'
regarding promises. Reproducable with the following template:In my controller I set
selectedItem
tomodel.item
. In my model, item is defined like this:On first render,
selectedItem
is aDS.PromiseObject
. Once that promise is resolved, only the{{view 'select'}}
is updated, but{{select-picker}}
remains onNothing Selected
. If I then choose an item on one of the select fields, the chosenitem
is directly loaded. Thus, it is amodel:item
and{{select-picker}}
gets updated. IMHO,select-picker
should handle promises correctly.