Skip to content

Commit

Permalink
Fix order and revert test
Browse files Browse the repository at this point in the history
(cherry picked from commit 56774c3)
  • Loading branch information
Ravenstine authored and kategengler committed Mar 15, 2021
1 parent 62b11ef commit 1fcd20a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
18 changes: 9 additions & 9 deletions packages/@ember/-internals/routing/lib/system/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,28 +303,28 @@ class EmberRouter extends EmberObject {

routeWillChange(transition: Transition) {
router.trigger('routeWillChange', transition);
if (router._routerService) {
if (DEBUG) {
freezeRouteInfo(transition);
}
router._routerService.trigger('routeWillChange', transition);
}
// in case of intermediate transition we update the current route
// to make router.currentRoute.name consistent with router.currentRouteName
// see https://github.com/emberjs/ember.js/issues/19449
if (transition.isIntermediate) {
router.set('currentRoute', transition.to);
}
if (DEBUG) {
freezeRouteInfo(transition);
}
if (router._routerService) {
router._routerService.trigger('routeWillChange', transition);
}
}

routeDidChange(transition: Transition) {
router.set('currentRoute', transition.to);
once(() => {
router.trigger('routeDidChange', transition);
if (DEBUG) {
freezeRouteInfo(transition);
}
if (router._routerService) {
if (DEBUG) {
freezeRouteInfo(transition);
}
router._routerService.trigger('routeDidChange', transition);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,8 @@ moduleFor(
['null - undefined', 'parent.index beforeModel', null],
['null - undefined', 'parent.index model', null],
['null - undefined', 'parent.loading activate', null],
[
'null - parent.loading',
'parent.loading routeWillChange: null - parent.loading',
null,
],
['null - parent.loading', 'parent.index routeWillChange: null - parent.loading', null],
['null - undefined', 'parent.loading routeWillChange: null - parent.loading', null],
['null - undefined', 'parent.index routeWillChange: null - parent.loading', null],
['parent.loading - parent.loading', 'parent.index afterModel', '/'],
['parent.loading - parent.loading', 'parent.index redirect', '/'],
['parent.loading - parent.loading', 'parent.index activate', '/'],
Expand Down Expand Up @@ -245,17 +241,17 @@ moduleFor(
['parent.index - parent.index', 'parent.child model', '/'],
['parent.index - parent.index', 'parent.loading activate', '/'],
[
'parent.index - parent.loading',
'parent.index - parent.index',
'parent.child routeWillChange: parent.index - parent.loading',
'/',
],
[
'parent.index - parent.loading',
'parent.index - parent.index',
'parent.loading routeWillChange: parent.index - parent.loading',
'/',
],
[
'parent.index - parent.loading',
'parent.index - parent.index',
'parent.index routeWillChange: parent.index - parent.loading',
'/',
],
Expand Down

0 comments on commit 1fcd20a

Please sign in to comment.