From 8f6911c54d9c311ae72101893cba7a66fe7b5373 Mon Sep 17 00:00:00 2001 From: Chris Garrett Date: Thu, 4 Feb 2021 19:30:09 -0800 Subject: [PATCH] address feedback --- packages/@ember/-internals/routing/lib/system/route.ts | 5 ++++- packages/@ember/-internals/routing/lib/system/router.ts | 9 +++++---- .../@ember/-internals/runtime/lib/system/core_object.js | 1 - 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/@ember/-internals/routing/lib/system/route.ts b/packages/@ember/-internals/routing/lib/system/route.ts index 6b10c65fa39..f4b2a0e1390 100644 --- a/packages/@ember/-internals/routing/lib/system/route.ts +++ b/packages/@ember/-internals/routing/lib/system/route.ts @@ -112,7 +112,10 @@ class Route extends EmberObject implements IRoute { let router = owner.lookup('router:main'); let bucketCache = owner.lookup(P`-bucket-cache:main`); - assert('Expected route injections to be defined', router && bucketCache); + assert( + 'ROUTER BUG: Expected route injections to be defined on the route. This is an internal bug, please open an issue on Github if you see this message!', + router && bucketCache + ); this._router = router; this._bucketCache = bucketCache; diff --git a/packages/@ember/-internals/routing/lib/system/router.ts b/packages/@ember/-internals/routing/lib/system/router.ts index 7d1dd84764a..a9439cb8643 100644 --- a/packages/@ember/-internals/routing/lib/system/router.ts +++ b/packages/@ember/-internals/routing/lib/system/router.ts @@ -1101,7 +1101,10 @@ class EmberRouter extends EmberObject { } else { let cacheKey = calculateCacheKey(qp.route.fullRouteName, qp.parts, state.params); - assert('expected appCache to be defined', appCache); + assert( + 'ROUTER BUG: expected appCache to be defined. This is an internal bug, please open an issue on Github if you see this message!', + appCache + ); queryParams[qp.scopedPropertyName] = appCache.lookup(cacheKey, qp.prop, qp.defaultValue); } @@ -1430,9 +1433,7 @@ export function triggerEvent( } else { // Should only hit here if a non-bubbling error action is triggered on a route. if (name === 'error') { - assert('expected handler and handler router to exist', handler && handler._router); - - handler._router._markErrorAsHandled(args[0] as Error); + handler!._router._markErrorAsHandled(args[0] as Error); } return; } diff --git a/packages/@ember/-internals/runtime/lib/system/core_object.js b/packages/@ember/-internals/runtime/lib/system/core_object.js index 3043ec66828..fec0361cfaf 100644 --- a/packages/@ember/-internals/runtime/lib/system/core_object.js +++ b/packages/@ember/-internals/runtime/lib/system/core_object.js @@ -90,7 +90,6 @@ function initialize(obj, properties) { let keyNames = Object.keys(properties); for (let i = 0; i < keyNames.length; i++) { - // Hot path so 'var' to avoid closure, which may cause perf issues let keyName = keyNames[i]; let value = properties[keyName];