Skip to content

Commit

Permalink
Use of _routerMicrolib.currentRouteInfos if available (#88)
Browse files Browse the repository at this point in the history
Because _routerMicrolib.currentHandlerInfos private API is deprecated
  • Loading branch information
BnitoBzh authored and poteto committed Mar 8, 2019
1 parent dc9ca2e commit bba1a1d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions addon/helpers/route-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ import { run } from '@ember/runloop';
import { runInDebug, assert } from '@ember/debug';
import { ACTION } from '../-private/internals';

function getCurrentHandlerInfos(router) {
function getCurrentInfos(router) {
let routerLib = router._routerMicrolib || router.router;

return routerLib.currentHandlerInfos;
return {
currentInfos: routerLib.currentRouteInfos || routerLib.currentHandlerInfos,
mapBy: routerLib.currentRouteInfos && 'route' || 'handler'
}
}

function getRoutes(router) {
return emberArray(getCurrentHandlerInfos(router))
.mapBy('handler')
const { currentInfos, mapBy } = getCurrentInfos(router);
return emberArray(currentInfos)
.mapBy(mapBy)
.reverse();
}

Expand Down

0 comments on commit bba1a1d

Please sign in to comment.