Skip to content

Commit b521501

Browse files
committed
Fix #20984: crash *during* destroy in fastboot
1 parent e9c61cc commit b521501

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

packages/@ember/-internals/glimmer/lib/renderer.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,16 @@ class ClassicRootState {
232232

233233
let result = (this.result = iterator.sync());
234234

235-
associateDestroyableChild(owner, result);
235+
// Associate the result with the root state (not the owner) so that
236+
// destruction cascades through:
237+
// Owner → Container → Renderer → RendererState → ClassicRootState → result
238+
// This ensures the container is still alive when component destructors
239+
// run (e.g. willDestroy looking up the renderer via injection).
240+
// Previously, associating with the owner made the result a sibling of
241+
// the Container, causing the Container to be destroyed first — which
242+
// broke FastBoot where the container was already dead by the time
243+
// component teardown tried to do lookups. (See: emberjs/ember.js#20984)
244+
associateDestroyableChild(this, result);
236245

237246
this.render = errorLoopTransaction(() => {
238247
if (isDestroying(result) || isDestroyed(result)) return;

0 commit comments

Comments
 (0)