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
How to unmount a root component? #36
Comments
Does component.unmount() not work? |
Just found it. I want to test deregistration of event handlers. |
Which seems not to be done in that case. In _updateElement there's the only place: if (!_.isEqual(oldData.handlers, data.handlers)) {
_.each(oldData.handlers, function(handler, event) {
$el.off(event);
});
_.each(data.handlers, function(handler, event) {
$el.on(event, handler.bind(scope.owner));
}, this);
} |
Well, this seems to be a bug. |
On a second thought: I don't think it is necessary to unbind the event handlers. They are part of the rendered element. It should not matter if they are still there after unmount. I would leave them. |
But wouldn't this prevent the component from being garbage collected if there's a handler from that component bound to the element that could potentially survive... I'm not sure i understand this completely. I mean why it does not matter to not call .off(). |
No. Why would it. Both, the component and the element are having the same life-time. |
Why should the element survive? |
Mhh.. probably true yes.. and if i keep a reference to the unmounted component or el, it's the user's fault. |
I think so. |
Once mounted injected, we have no way unmount a root component, or am I missing something?
The text was updated successfully, but these errors were encountered: