-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add setup
and reset
lifecycle hooks + replace
support
#30
Conversation
setupController
and resetController
hookssetup
and reset
lifecycle hooks + replace
support
const { | ||
keys | ||
} = Object; | ||
|
||
export function initialize(/* application */) { | ||
Ember.Route.reopen({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably shouldn't be reopening in an instance initializer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poteto what was the reason for switching over to an instance initializer?
tests/integration/route-test.js
Outdated
integration: true, | ||
|
||
beforeEach() { | ||
Ember.Route = Ember.Route.extend(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad
As discussed let's do a readme overhaul in a separate PR |
// Overrides | ||
event.shouldRefresh = false; | ||
|
||
tryInvoke(controller, 'reset', [event, isExiting]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious if we should even send a ParachuteEvent
on resetController
. Is there a scenario where the QPs change when the route resets? In the reset
hook, the user can still access current QPs, reset QPs etc via the mixin. So it seems like we might be sending more than is necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it for the sake of consistency. That way you have access to all the same data in setup
, reset
, and queryParamsDidChange
.
setup
lifecycle hookreset
lifecycle hookreplace
from the QP mapnew QueryParams()
. This can allow anyone to take advantage of all the life cycle hooks even if they dont have QPs to declare.With this PR we can actually eliminate the need for the route to declare any query params as well as handling data 🎉