Route willTransition deprecation, new patterns?

Hello,

I have a question related to Ember.js - Deprecations

The recommended way is to attach to router events in the init. This leaves me with questions. Please correct me when I’m wrong:

  • Routes are lazy instantiated
  • Routes are singletons
  • When does a route get destroyed? It seems never. Leading to the question ‘why is there a willDestroy method on the Route class?’
  • If this is all true then it’s ok to attached to Router events in this init method. But if somehow Route could be destroyed then we should attach/detach from router events in the activate/deactivate methods?!

Hi! I don’t think anything has changes with Routes. They get stamped out as instances and torn down when you leave. The docs you are pointing to is the Router, which I would assume is a singleton. In the Route, you listen to these changes on the router service.

https://deprecations.emberjs.com/v3.x/#toc_remove-handler-infos

1 Like