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

Blaze.remove doesn't remove DOM nodes when Blaze.renderWithData is used to create the template #3130

Closed
davidworkman9 opened this Issue Nov 19, 2014 · 3 comments

Comments

Projects
None yet
4 participants
@davidworkman9
Contributor

davidworkman9 commented Nov 19, 2014

Reproduction here

@n1mmy n1mmy added the Project:Blaze label Nov 19, 2014

Slava added a commit that referenced this issue Dec 9, 2014

Use a special flag to mark when Blaze views have..
autogenerated parents those need to be gc'd with their children.
Should help with #3130

Slava added a commit that referenced this issue Dec 9, 2014

@Slava

This comment has been minimized.

Member

Slava commented Dec 9, 2014

Hi @davidworkman9, thanks for this report and a very clear reproduction. I submitted a fix in #3261, waiting for a review from the Blaze team :)

@davidworkman9

This comment has been minimized.

Contributor

davidworkman9 commented Dec 9, 2014

Thanks :)

dgreensp added a commit that referenced this issue Dec 9, 2014

Expand fix for #3130
If you Blaze.remove a View that is a template rendered by Blaze.renderWithData, or included with an implicit “with” as in `{{> myTemplate someData}}`, Blaze will now remove the DOM of the template, and also remove the implicit “with” (in both cases).

As background, Blaze.remove only works on Views that were attached directly under a DOM element, not inside another View.  Blaze.render always attaches the resulting View directly under a DOM element, but Blaze.renderWithData creates a “with” View around the template View.  Previously, you could Blaze.remove the “with” View (which is returned by renderWithData), but if you got access to the template’s View some other way and tried to remove it directly, nothing would happen.  Now, the correct thing happens (the View is destroyed and the DOM is removed).

In the future, we should consider whether Blaze.remove should work on arbitrary Views, not just Views attached under a DOM element.
@dgreensp

This comment has been minimized.

Contributor

dgreensp commented Dec 9, 2014

Fixed on devel.

martijnwalraven pushed a commit that referenced this issue Feb 22, 2016

Use a special flag to mark when Blaze views have..
autogenerated parents those need to be gc'd with their children.
Should help with #3130

martijnwalraven pushed a commit that referenced this issue Feb 22, 2016

Expand fix for #3130
If you Blaze.remove a View that is a template rendered by Blaze.renderWithData, or included with an implicit “with” as in `{{> myTemplate someData}}`, Blaze will now remove the DOM of the template, and also remove the implicit “with” (in both cases).

As background, Blaze.remove only works on Views that were attached directly under a DOM element, not inside another View.  Blaze.render always attaches the resulting View directly under a DOM element, but Blaze.renderWithData creates a “with” View around the template View.  Previously, you could Blaze.remove the “with” View (which is returned by renderWithData), but if you got access to the template’s View some other way and tried to remove it directly, nothing would happen.  Now, the correct thing happens (the View is destroyed and the DOM is removed).

In the future, we should consider whether Blaze.remove should work on arbitrary Views, not just Views attached under a DOM element.

martijnwalraven pushed a commit that referenced this issue Feb 22, 2016

martijnwalraven pushed a commit that referenced this issue Feb 22, 2016

Expand fix for #3130
If you Blaze.remove a View that is a template rendered by Blaze.renderWithData, or included with an implicit “with” as in `{{> myTemplate someData}}`, Blaze will now remove the DOM of the template, and also remove the implicit “with” (in both cases).

As background, Blaze.remove only works on Views that were attached directly under a DOM element, not inside another View.  Blaze.render always attaches the resulting View directly under a DOM element, but Blaze.renderWithData creates a “with” View around the template View.  Previously, you could Blaze.remove the “with” View (which is returned by renderWithData), but if you got access to the template’s View some other way and tried to remove it directly, nothing would happen.  Now, the correct thing happens (the View is destroyed and the DOM is removed).

In the future, we should consider whether Blaze.remove should work on arbitrary Views, not just Views attached under a DOM element.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment