Skip to content

Commit d8a8382

Browse files
NullVoxPopuliclaude
andcommitted
[BUGFIX beta] Destroy dynamic modifiers that were set after the initial render
Register the UpdateDynamicModifierOpcode as a destroyable child of its block. Instances that the opcode creates on update are attached to the opcode with associateDestroyableChild, so the block now reaches them when it is destroyed. Fixes the leak reported in universal-ember/ember-primitives#805. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fvnp457DHuZC4fBa2KCiqB
1 parent 14f95ce commit d8a8382

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • packages/@glimmer/runtime/lib/compiled/opcodes

‎packages/@glimmer/runtime/lib/compiled/opcodes/dom.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,12 @@ APPEND_OPCODES.add(VM_DYNAMIC_MODIFIER_OP, (vm) => {
296296
}
297297

298298
if (!isConstRef(ref) || tag) {
299-
return vm.updateWith(new UpdateDynamicModifierOpcode(tag, instance, instanceRef));
299+
let updateOpcode = new UpdateDynamicModifierOpcode(tag, instance, instanceRef);
300+
301+
// The block must own this opcode, or instances created on update are never destroyed.
302+
vm.associateDestroyable(updateOpcode);
303+
304+
return vm.updateWith(updateOpcode);
300305
}
301306
});
302307

0 commit comments

Comments
 (0)