fix(components) $dispose not always called#306
Open
benouat wants to merge 1 commit intoariatemplates:masterfrom
Open
fix(components) $dispose not always called#306benouat wants to merge 1 commit intoariatemplates:masterfrom
benouat wants to merge 1 commit intoariatemplates:masterfrom
Conversation
fa83f40 to
a4d9770
Compare
benouat
pushed a commit
to benouat/hashspace
that referenced
this pull request
Sep 24, 2014
Let's consider a template like that ``` <template test(data)> <#data.ref /> </template> ``` When changing the component template behinf `data.ref` corresponding `$dispose()` method (if any defined in the controller class) were not executed. Closes ariatemplates#306
a4d9770 to
d245a52
Compare
benouat
pushed a commit
to benouat/hashspace
that referenced
this pull request
Sep 24, 2014
Let's consider a template like that ``` <template test(data)> <#data.ref /> </template> ``` When changing the component template behinf `data.ref` corresponding `$dispose()` method (if any defined in the controller class) were not executed. Closes ariatemplates#306
hsp/rt/$root.js
Outdated
Member
There was a problem hiding this comment.
I think this is not enough as apparently the $dispose method is not called on the template root node (cf. $root.js line 120). So we should keep a reference on the template root node (which is returned when the template function is called) and call $dispose() on this reference. This should both dispose the node chain and the controller
(sorry I just realize this now!)
Member
Author
There was a problem hiding this comment.
This is somehow valid, but could be done in another PR.
Nevertheless, the $RootNode.$dispose method as far as I get it is only called when we don't want to keep localProperties on the node itself.
/**
* Default dispose method
* @param {Boolean} localPropOnly if true only local properties will be deleted (optional)
* must be used when a new instance is created to adapt to a path change
*/
$dispose:function(localPropOnly) {
this.cleanObjectProperties(localPropOnly);
},
/**
* Removes object properties - helper for $dispose methods
* @param {Boolean} localPropOnly if true only local properties will be deleted (optional)
* must be used when a new instance is created to adapt to a path change
*/
cleanObjectProperties : function (localPropOnly) {
this.removePathObservers();
if (this._scopeChgeCb) {
json.unobserve(this.vscope, this._scopeChgeCb);
this._scopeChgeCb = null;
}
if (localPropOnly!==true) {
$RootNode.$dispose.call(this);
}
this.exps = null;
this.controller = null;
this.ctlAttributes = null;
this.template = null;
if (this.node1) {
this.node1=null;
this.node2=null;
}
}d245a52 to
95d5dcb
Compare
benouat
pushed a commit
to benouat/hashspace
that referenced
this pull request
Sep 30, 2014
Let's consider a template like that ``` <template test(data)> <#data.ref /> </template> ``` When changing the component template behind `data.ref` corresponding `$dispose()` method (if any defined in the controller class) was not executed. Closes ariatemplates#306
95d5dcb to
59b89c0
Compare
benouat
pushed a commit
to benouat/hashspace
that referenced
this pull request
Oct 1, 2014
Let's consider a template like that ``` <template test(data)> <#data.ref /> </template> ``` When changing the component template behind `data.ref` corresponding `$dispose()` method (if any defined in the controller class) was not executed. Closes ariatemplates#306
59b89c0 to
7d44055
Compare
benouat
pushed a commit
to benouat/hashspace
that referenced
this pull request
Oct 1, 2014
Let's consider a template like that ``` <template test(data)> <#data.ref /> </template> ``` When changing the component template behind `data.ref` corresponding `$dispose()` method (if any defined in the controller class) was not executed. Closes ariatemplates#306
7d44055 to
f7c5c35
Compare
benouat
pushed a commit
to benouat/hashspace
that referenced
this pull request
Oct 1, 2014
Let's consider a template like that ``` <template test(data)> <#data.ref /> </template> ``` When changing the component template behind `data.ref` corresponding `$dispose()` method (if any defined in the controller class) was not executed. Closes ariatemplates#306
Let's consider a template like that ``` <template test(data)> <#data.ref /> </template> ``` When changing the component template behind `data.ref` corresponding `$dispose()` method (if any defined in the controller class) was not executed. Closes ariatemplates#306
f7c5c35 to
e751e80
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Let's consider a template like that
When changing the component template behinf
data.refcorresponding$dispose()method (if any defined in the controller class) were notexecuted.