Quantcast
Viewing all articles
Browse latest Browse all 4826

Computed property is not updated when computed on object's property

@Jeffrey_Cheung wrote:

I think I have found a bug on computed property. I have a component my-cell, responsible for render 1 event.

Please take a look at my component/my-cell.js

export default Ember.Component.extend({ 
    isHighlighted: Ember.computed('highlight', 'event.createdAt', function() {
        //set highlight to true if event.createdAt has the same time as highlight time
    }
});

When isHighlighted is called, I put a breakpoint there, I found that this.get('event.createdAt') returns undefined.
To be more informative, event is an object from data store. So this.get('event') would get me the event, but all properties of event are undefined.

When the page is finished loading, by Ember Inspector, event.createdAt is not undefined anymore.

I suspect my problem is because Ember will not load the whole object with its property into component.

How do I get around this? Is my approach right or not? Please point me out if I made any mistakes. Thank you.

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles