diff --git a/packages/ember-routing/lib/services/routing.js b/packages/ember-routing/lib/services/routing.js index 56046d076d7..53628afa91b 100644 --- a/packages/ember-routing/lib/services/routing.js +++ b/packages/ember-routing/lib/services/routing.js @@ -7,9 +7,7 @@ import { Service, readOnly } from 'ember-runtime'; - import { get } from 'ember-metal'; -import { routeArgs } from '../utils'; /** The Routing service is used by LinkComponent, and provides facilities for @@ -46,21 +44,17 @@ export default Service.extend({ }, normalizeQueryParams(routeName, models, queryParams) { - let router = get(this, 'router'); - router._prepareQueryParams(routeName, models, queryParams); + get(this, 'router')._prepareQueryParams(routeName, models, queryParams); }, generateURL(routeName, models, queryParams) { - let router = get(this, 'router'); - if (!router._routerMicrolib) { return; } - let visibleQueryParams = {}; - assign(visibleQueryParams, queryParams); - - this.normalizeQueryParams(routeName, models, visibleQueryParams); + if (queryParams) { + assign(visibleQueryParams, queryParams); + this.normalizeQueryParams(routeName, models, visibleQueryParams); + } - let args = routeArgs(routeName, models, visibleQueryParams); - return router.generate(...args); + return get(this, 'router').generate(routeName, ...models, { queryParams: visibleQueryParams }); }, isActiveForRoute(contexts, queryParams, routeName, routerState, isCurrentWhenSpecified) { diff --git a/packages/ember-routing/lib/system/router.js b/packages/ember-routing/lib/system/router.js index 5110a602d48..5e4c3e71ce8 100644 --- a/packages/ember-routing/lib/system/router.js +++ b/packages/ember-routing/lib/system/router.js @@ -32,7 +32,6 @@ import { import EmberRouterDSL from './dsl'; import EmberLocation from '../location/api'; import { - routeArgs, resemblesURL, getActiveTargetName, calculateCacheKey, @@ -766,8 +765,7 @@ const EmberRouter = EmberObject.extend(Evented, { assign(queryParams, _queryParams); this._prepareQueryParams(targetRouteName, models, queryParams, _keepDefaultQueryParamValues); - let transitionArgs = routeArgs(targetRouteName, models, queryParams); - let transition = this._routerMicrolib.transitionTo(...transitionArgs); + let transition = this._routerMicrolib.transitionTo(targetRouteName, ...models, { queryParams }); didBeginTransition(transition, this); diff --git a/packages/ember-routing/lib/utils.js b/packages/ember-routing/lib/utils.js index dc40de15572..789037ca0b3 100644 --- a/packages/ember-routing/lib/utils.js +++ b/packages/ember-routing/lib/utils.js @@ -20,16 +20,6 @@ export function extractRouteArgs(args) { return { routeName, models: args, queryParams }; } -export function routeArgs(targetRouteName, models, queryParams) { - let args = []; - if (typeof targetRouteName === 'string') { - args.push(`${targetRouteName}`); - } - args.push(...models); - args.push({ queryParams }); - return args; -} - export function getActiveTargetName(router) { let handlerInfos = router.activeTransition ? router.activeTransition.state.handlerInfos :