Skip to content

Commit 40040a7

Browse files
committed
Remove deps and new router usage (addons test in 2.8)
1 parent 1d24c8b commit 40040a7

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

addon/components/docs-viewer/x-nav-item/component.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { inject as service } from '@ember/service';
22
import Component from '@ember/component';
33
import layout from './template';
4+
import { next } from '@ember/runloop';
45

56
export default Component.extend({
67
layout,
@@ -11,8 +12,14 @@ export default Component.extend({
1112

1213
didInsertElement() {
1314
this._super(...arguments);
14-
this.get('docsRoutes.items').addObject(this);
15-
},
15+
16+
next(() => {
17+
this.get('docsRoutes.items').addObject(this);
18+
});
19+
}
20+
1621
}).reopenClass({
22+
1723
positionalParams: ['label', 'route', 'model']
24+
1825
});

addon/services/docs-routes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ export default Service.extend({
3535
});
3636
}),
3737

38-
currentRouteIndex: computed('router.router.currentURL', 'routeUrls.[]', function() {
38+
currentRouteIndex: computed('router.router.url', 'routeUrls.[]', function() {
3939
if (this.get('routeUrls.length')) {
4040
let router = this.get('router.router');
41-
let currentURL = router.get('rootURL') + router.get('currentURL');
41+
let currentURL = router.get('rootURL') + router.get('url');
4242
currentURL = currentURL
4343
.replace("//", "/") // dedup slashes
4444
.replace(/\/$/, ""); // remove trailing slash
4545
let index = this.get('routeUrls').indexOf(currentURL);
46-
assert(`DocsRoutes wasn't able to correctly detect the current route.`, index > -1);
46+
assert(`DocsRoutes wasn't able to correctly detect the current route. The current url is ${currentURL}`, index > -1);
4747
return index;
4848
}
4949
}),

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"ember-keyboard": "^2.3.0",
3737
"ember-modal-dialog": "yapplabs/ember-modal-dialog#a14f0a33c1c7cc9d7a77f86512732b920a8befe8",
3838
"ember-router-scroll": "^0.4.0",
39+
"ember-router-service-polyfill": "^1.0.2",
3940
"ember-svg-jar": "^0.11.1",
4041
"ember-truth-helpers": "^2.0.0",
4142
"fs-extra": "^4.0.2",

0 commit comments

Comments
 (0)