Skip to content

Commit a45563b

Browse files
committed
menu bug fixes.
1 parent a6bb982 commit a45563b

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/Server/Coderr.Server.Web/ClientApp/components/analyze/incidents/incident.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ export default class AnalyzeIncidentComponent extends Vue {
2828

2929
created() {
3030
MyIncidents.Instance.subscribeOnSelectedIncident(x => {
31-
if (x == null) {
32-
this.$router.push({ name: 'analyzeHome' });
33-
} else {
34-
this.loadIncident(x.incidentId);
35-
}
31+
this.selectIncident(x);
3632
});
3733
}
3834

@@ -41,6 +37,10 @@ export default class AnalyzeIncidentComponent extends Vue {
4137
this.loadIncident(incidentId);
4238
}
4339

40+
destroyed() {
41+
MyIncidents.Instance.unsubscribe(this.selectIncident);
42+
}
43+
4444
reAssign() {
4545
AppRoot.modal({
4646
contentId: 'assignToModal',
@@ -162,4 +162,11 @@ export default class AnalyzeIncidentComponent extends Vue {
162162
}
163163

164164

165+
selectIncident(myIncident: IMyIncident | null): void {
166+
if (myIncident == null) {
167+
this.$router.push({ name: 'analyzeHome' });
168+
} else {
169+
this.loadIncident(myIncident.incidentId);
170+
}
171+
}
165172
}

src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export default class AnalyzeMenuComponent extends Vue {
2020
incidentId: number | null = null;
2121

2222
created() {
23-
MyIncidents.Instance.subscribeOnSelectedIncident(x => this.onIncidentSelected(x));
24-
MyIncidents.Instance.subscribeOnListChanges(() => this.onListChanged());
23+
MyIncidents.Instance.subscribeOnSelectedIncident(this.onIncidentSelected);
24+
MyIncidents.Instance.subscribeOnListChanges(this.onListChanged);
2525
MyIncidents.Instance.ready()
2626
.then(x => {
2727
this.incidents = MyIncidents.Instance.myIncidents;
@@ -86,7 +86,6 @@ export default class AnalyzeMenuComponent extends Vue {
8686
} else {
8787
var newIncidentId = parseInt(value, 10);
8888
if (this.incidentId === newIncidentId) {
89-
console.log('exiting')
9089
return;
9190
}
9291
this.incidentId = newIncidentId;

0 commit comments

Comments
 (0)