Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref binding to child object causes unbind failure #372

Closed
snortblt opened this issue Mar 21, 2016 · 9 comments · Fixed by aurelia/templating#306
Closed

ref binding to child object causes unbind failure #372

snortblt opened this issue Mar 21, 2016 · 9 comments · Fixed by aurelia/templating#306
Assignees
Labels

Comments

@snortblt
Copy link

Using the ref binding to a child object of a vm property as shown works until the view is destroyed.

`


  • ${option.text}

  • `

    When the view is being unbound, the context object in the following snippet from aurelia-binding.js (beta 1.2.2) is null.

    AccessScope.prototype.evaluate = function evaluate(scope, lookupFunctions) { var context = getContextFor(this.name, scope, this.ancestor); return context[this.name]; };

    @EisenbergEffect
    Copy link
    Contributor

    I believe this has already been fixed. Run jspm update to get the latest and please try again. Thanks!

    @snortblt
    Copy link
    Author

    Yeah, maybe not so much. I updated prior to posting this and again just now. Doesn't work over here. I will say that the parent object is transitive and part of the dependency tree itself. I suspect that may not be supported.

    @computedFrom('currentIndex','childVM', 'childVM.hasAnswer')

    @EisenbergEffect
    Copy link
    Contributor

    We will need a repro to see the actual problem so we can fix it.

    @EisenbergEffect
    Copy link
    Contributor

    I don't think computedFrom supports property paths until after the upcoming release is out. So, there may be a problem with your decorator as well.

    @snortblt
    Copy link
    Author

    Ugh. My bad. I was confusing the computedFrom issue with this other issue, but thanks for reporting status on that too. I need to get more sleep.

    The unbinding issue continues to be a problem after updating.

    @EisenbergEffect
    Copy link
    Contributor

    Can you provide us with a simple reproduction. I imagine @jdanyow could fix this pretty easily if we had this.

    @snortblt
    Copy link
    Author

    Thanks. Let me see what I can do with the navigation skeleton app to repro.

    @snortblt
    Copy link
    Author

    Aurelia Bug 372 demo.zip

    This exhibits the behavior. Just click the 'Next View' button, which will load a new child view. Every other view instantiation will throw the exception.

    @EisenbergEffect EisenbergEffect self-assigned this Mar 23, 2016
    @jdanyow
    Copy link
    Contributor

    jdanyow commented Mar 24, 2016

    Thanks @snortblt, I've distilled your sample down to this:
    https://gist.run/?id=de82773d5e8fd23c4ff7

    Looks like we need to move these lines to the end of the view's unbind method.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    Successfully merging a pull request may close this issue.

    3 participants