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

unbind callback not being invoked #16

Closed
simonfox opened this issue Nov 19, 2015 · 6 comments
Closed

unbind callback not being invoked #16

simonfox opened this issue Nov 19, 2015 · 6 comments
Assignees
Labels

Comments

@simonfox
Copy link

The unbind lifecycle callback isn't being invoked.

To reproduce, just add an unbind() function to the welcome VM in the skeleton. When you navigate away from the welcome page, unbind doesn't get called.

@simonfox
Copy link
Author

@EisenbergEffect

I think this is the commit where things may have gone wrong.

Then this commit switches to using ViewSlot.remove which doesn't do an unbind.

Should the unbind call be the responsibility of the swap strategy? I'd be happy to put together a PR if that would help?

@bryanrsmith
Copy link
Contributor

Your assessment looks right to me, but maybe Rob can confirm. I think a PR would be great! Let me know if I can help.

@simonfox
Copy link
Author

Hi @EisenbergEffect can I get your thoughts on this?

I think the problem is not just isolated to the router, as unbind isn't getting called when using compose elements either.

would adding the following to the removeAction of ViewSlot.removeAt be sufficient?

if (view.isBound) {
    view.unbind();
}

@EisenbergEffect
Copy link
Contributor

Remove doesn't imply unbind. So, that's not the best fix. I can look into
it this week and issue a patch.
On Nov 22, 2015 4:53 PM, "Simon Fox" notifications@github.com wrote:

Hi @EisenbergEffect https://github.com/EisenbergEffect can I get your
thoughts on this?

I think the problem is not just isolated to the router, as unbind isn't
getting called when using compose elements either.

would adding the following to the removeAction of ViewSlot.removeAt
https://github.com/aurelia/templating/blob/master/src/view-slot.js#L181
be sufficient?

if (view.isBound) {
view.unbind();
}


Reply to this email directly or view it on GitHub
#16 (comment)
.

@jdanyow
Copy link
Contributor

jdanyow commented Nov 29, 2015

@briannoyes reported an issue that I traced it back to this.

The bug causes problems with the repeat because unbind isn't called between calls to bind.

@EisenbergEffect EisenbergEffect self-assigned this Nov 29, 2015
@EisenbergEffect
Copy link
Contributor

I'll take care of this this week.

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

No branches or pull requests

4 participants