emberjs / ember.js

Ember.js - A JavaScript framework for creating ambitious web applications
https://emberjs.com
MIT License
22.47k stars 4.21k forks source link

[Canary] `transitionTo` from Ember.Route#activate nukes parent route template #11152

Open poteto opened 9 years ago

poteto commented 9 years ago

I encountered this bug in my own app running Canary (1.13.0-beta.1+canary.5ff3d02e), and have reproduced it below in a JSBin.

http://jsbin.com/mepasu/edit?html,js,output

In the above JSBin, there are 2 routes (page and page/show) being explicitly defined, with one being a child of another. Transitioning to one of these routes in the Application index route within its activate hook causes an issue where the page template disappears, leaving behind only its {{outlet}}.

If you navigate through the app by clicking on the buttons, you'll notice that you can still transition to page.index and page.show, but they no longer appear inside of the page template.

This issue only seems to affect the activate hook – if you uncomment beforeModel, model, or afterModel hooks, they work as expected. There are also no errors being logged/thrown.

cc @rwjblue

rwjblue commented 9 years ago

Definitely weird. Will need to dig a bit more to have an idea of the root cause...

acorncom commented 8 years ago

We should probably reproduce this issue with the latest canary to see if it's still a problem (possibly with Ember Twiddle)

poteto commented 8 years ago

I can get a twiddle up, but the jsbin is pointing to the canary channel so it still seems to be an issue

poteto commented 8 years ago

See https://ember-twiddle.com/872f4a84bfda8499904cb33f6348154d (gist)

pixelhandler commented 8 years ago

@poteto regarding…

This issue only seems to affect the activate hook – if you uncomment beforeModel, model, or afterModel hooks, they work as expected. There are also no errors being logged/thrown.

Could the solution be to not use activate for a transition? Is there a case that prevents you from using beforeModel()?

Would using redirect be a more viable solution?

Was there an Ember release where using activate for a transition did work?

pixelhandler commented 6 years ago

Just checked on v3.4.1 and updated the twiddle, seems like the issue still happens.

@poteto did you find a work around? using the beforeModel hook in stead of activate does work.