Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Garrett committed Feb 5, 2021
1 parent f1d80e4 commit 8f6911c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion packages/@ember/-internals/routing/lib/system/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ class Route extends EmberObject implements IRoute {
let router = owner.lookup<EmberRouter>('router:main');
let bucketCache = owner.lookup<BucketCache>(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;
Expand Down
9 changes: 5 additions & 4 deletions packages/@ember/-internals/routing/lib/system/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down

0 comments on commit 8f6911c

Please sign in to comment.