You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: Whenever the content of a {{#default}} block is regenerated, the event handlers for any bindings inside of it are leaked.
Steps to reproduce:
Run the following code:
var VM = DefineMap.extend({
list: {
Type: DefineList,
value() {
return new DefineList([1, 2]);
}
},
number: {
value: 0,
set(val) {
this.numberSubscriptions = this.__bindEvents.number && this.__bindEvents.number.length;
return val;
}
},
numberSubscriptions: {
},
addItem() {
this.number++;
},
removeItem() {
this.number--;
}
});
var vm = new VM();
var template = stache(`
{{<testPartial}}
{{/testPartial}}
Subscriptions: {{numberSubscriptions}}
<ul>
{{#switch number}}
{{#case 1}}
One!
{{/case}}
{{#case 2}}
Two!
{{/case}}
{{#default}}
Value: {{number}}
{{/default}}
{{/switch}}
</ul>
<button on:click="addItem()">Add an item</button>
<button on:click="removeItem()">Remove an item</button>
`);
var frag = template(vm);
document.body.appendChild(frag);
Expected results: The number of event handlers listening to the number event on the view model should remain constant when you click the buttons.
Actual results: When you click the Add or Remove buttons, if the number is set to 1 or 2, the number of Subscriptions doesn't change. But if it's set to any other value, the event bindings grow indefinitely.
Environment:
Here's the contents of the package.json file:
How often can you reproduce it?
Description: Whenever the content of a {{#default}} block is regenerated, the event handlers for any bindings inside of it are leaked.
Steps to reproduce:
Run the following code:
Expected results: The number of event handlers listening to the
number
event on the view model should remain constant when you click the buttons.Actual results: When you click the Add or Remove buttons, if the number is set to 1 or 2, the number of Subscriptions doesn't change. But if it's set to any other value, the event bindings grow indefinitely.
Environment:
Here's the contents of the package.json file:
The text was updated successfully, but these errors were encountered: