emberjs / emberjs/ember.js

[3.17] [Bug] didInsert / willDestroy Firing Out Of Order

Open
#18,873 16 comments 6 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

I have 2 routes, each with 1 component. Each component uses the {{did-insert}} render modifier and the willDestroy action.

**Problem**
When transitioning routes the did-insert action for the new component, on the new route fires before the willDestroy action of the old component on the old route.

I would expect the old component, on the route I am transitioning from, to be destroyed before the new component on the route I am transitioning to fires {{did-insert}}

**Reproduction Scenario**
I have created an Ember Twiddle to illustrate the problem
https://ember-twiddle.com/2412fd6f6549a66ae4e20c3cb0613858?openFiles=components.scene-2%5C.js%2Ctemplates.components.scene-2%5C.hbs

You will need to use the developer console to see the output. Which should look like the below, which happens when transitioning from Index -> Page 2

[Log] Scene 1 - didInsert
[Log] Scene 2 - didInsert
[Log] Scene 1 - willDestroy

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.