Cannot bind to future nested properties #1657

Closed
akagomez opened this Issue Apr 30, 2015 · 4 comments

Comments

Projects
None yet
4 participants
@akagomez
Contributor

akagomez commented Apr 30, 2015

var state = new can.Map({
    parent: null
});

var helpers = {
    childExists: function (options) {
        return this.attr('parent.child') ?
            options.fn() :
            options.inverse();
    }
}

var frag = can.stache('{{#childExists}}{{/childExists}}')(state, helpers);

// Does not cause helper to be re-evaluated
state.attr('parent', {
    child: 'foo'
}); 

I'm not sure if this is meant to be supported, but it sure would be awesome not to have to do this.attr('parent') && this.attr('parent.child') for situations like these.

Spun off from #1651.

/cc @kylegifford

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Apr 30, 2015

Contributor

This is due to where can.__reading is called within can.Map. I tried to move it into _get, where I think it belongs, but a bunch of things broke. I don't remember why, but that is the solution.

Contributor

justinbmeyer commented Apr 30, 2015

This is due to where can.__reading is called within can.Map. I tried to move it into _get, where I think it belongs, but a bunch of things broke. I don't remember why, but that is the solution.

@akagomez akagomez self-assigned this Apr 30, 2015

@akagomez

This comment has been minimized.

Show comment
Hide comment
@akagomez

akagomez Apr 30, 2015

Contributor

Awesome! I'll run with that.

Contributor

akagomez commented Apr 30, 2015

Awesome! I'll run with that.

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer May 14, 2015

Contributor

related to #1231

Contributor

justinbmeyer commented May 14, 2015

related to #1231

@justinbmeyer justinbmeyer added bug and removed enhancement labels May 14, 2015

justinbmeyer added a commit that referenced this issue May 14, 2015

@daffl daffl added this to the 2.2.6 milestone May 14, 2015

justinbmeyer added a commit that referenced this issue May 14, 2015

@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer May 14, 2015

Contributor

Closed by #1696.

Contributor

justinbmeyer commented May 14, 2015

Closed by #1696.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment