ember-computed-indirect icon indicating copy to clipboard operation
ember-computed-indirect copied to clipboard

Ember 2.8 support

Open MarSik opened this issue 8 years ago • 3 comments

Hi,

I am hitting a strange behaviour in Ember 2.8. It seems that the get direction works just fine, but the set is not propagated. Is it possible something changed with relation to the data down / events up direction Ember has?

Thanks.

MarSik avatar Dec 14 '16 16:12 MarSik

Nevermind, it seems to be caused by something else I missed.

MarSik avatar Dec 14 '16 16:12 MarSik

Ok, I tested this again with better debugging and a component like this:

export default Ember.Component.extend({
    actions: {
        saveEdit: function () {
            this.set('show', this.get('value'));
            console.log("Edit save: ", this.get('value'), " -> ", this.get('field'), " = ", this.get(this.get('field')), ' = ', this.get('show'));
            this.get('content').save();
            this.set('editing', false);
        }
    },
    content: undefined,
    field: undefined,
    show: Ember.computed.indirect('field')
    value: null # linked to the edit field, starting the edit copies show -> value

Used like this:

{{#click-to-editarea content=model field='content.summary'}}

Prints out:

Edit save:  test 12  ->  content.summary  =  test  =  test 12

So it seems the indirect proxy itself knows about the change, but the underlying variable is not updated.

MarSik avatar Dec 16 '16 13:12 MarSik

Would you mind testing the same case, but hard-coding content.summary as the value for field instead of passing it to the component in the template? It's been a long time since I've worked with this, but my gut says it's some sort of weirdness with observers and initializers and whatnot.

gordonkristan avatar Dec 19 '16 04:12 gordonkristan