Regarding the new Ember.js routing system (described here), if I understand correctly, views are destroyed when you exit a route.
Is there any way to bypass destruction of views upon exiting a route, so that the state of the view is preserved when the user re-enters the route?
Update: Looks like, views are not destroyed unless the outlet view is being replaced in the new route. For e.g., if you are in stateA with ViewA in some {{outlet master}} and you go to stateB with ViewB in {{outlet master}}, then ViewB will replace ViewA. A way around this is to define multiple outlets when you need to preserve views, e.g., {{outlet master1}}, {{outlet master2}}, …
A nice feature would be the ability to pass an array of views to the outlet. And also be able to choose whether views will be destroyed or just become hidden, upon exiting a route.
I have since figure out how to modify the routing system, so that views inserted into outlets are not destroyed. First I override the Handlebars
outlethelper, so that it loads anEmber.OutletViewinto{{outlet}}:Where
Ember.OutletViewextendsEmber.ContainerViewas follows:Basically we override
_currentViewWillChange()and just hide allchildViewsinstead of removing thecurrentView. Then in_currentViewDidChange()we check if thecurrentViewis already insidechildViewsand act accordingly. TheEmber.View.isEqualis a modified version of UnderscoreisEqual: