Skip to content

Commit 6504f1e

Browse files
jenwebermansona
andcommitted
Refactor some inits
Co-authored-by: Chris Manson <[email protected]>
1 parent b4642d8 commit 6504f1e

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

app/services/filter-data.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
import Service from '@ember/service';
22

33
export default class FilterDataService extends Service {
4+
// These attributes are not @tracked because they are used in computed
5+
// properties and not directly in templates.
46
showInherited = false;
57
showProtected = false;
68
showPrivate = false;
79
showDeprecated = false;
8-
sideNav = null;
910

10-
init() {
11-
this.sideNav = {
12-
showPrivate: false,
13-
};
14-
super.init(...arguments);
15-
}
11+
sideNav = {
12+
showPrivate: false,
13+
};
1614
}

app/services/legacy-module-mappings.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fetch from 'fetch';
22
import Service from '@ember/service';
3+
import { tracked } from '@glimmer/tracking';
34

45
const LOCALNAME_CONVERSIONS = {
56
Object: 'EmberObject',
@@ -8,14 +9,16 @@ const LOCALNAME_CONVERSIONS = {
89
};
910

1011
export default class LegacyModuleMappingsService extends Service {
12+
@tracked mappings;
13+
1114
async initMappings() {
1215
try {
1316
let response = await this.fetch();
1417
let mappings = await response.json();
1518
let newMappings = this.buildMappings(mappings);
16-
this.set('mappings', newMappings);
19+
this.mappings = newMappings;
1720
} catch (e) {
18-
this.set('mappings', []);
21+
this.mappings = [];
1922
}
2023
}
2124

app/services/project.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Service from '@ember/service';
2-
import { tracked } from '@glimmer/tracking'
2+
import { tracked } from '@glimmer/tracking';
33

44
export default class ProjectService extends Service {
55
@tracked version = '0.0.0';

0 commit comments

Comments
 (0)