Skip to content

Commit dcd238e

Browse files
committed
used urlparams instead of computed
1 parent 8eceeea commit dcd238e

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

web/src/app/components/job-list-item/job-list-item.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ export class JobListItemComponent implements OnInit, OnDestroy {
3939
@Input() job?: Job;
4040
@Input() actionsType: JobListItemActionsType = JobListItemActionsType.MENU;
4141

42-
private surveyIdSignal = this.navigationService.getSurveyId();
43-
private loiIdSignal = this.navigationService.getLoiId();
42+
private urlParamsSignal = this.navigationService.getUrlParams();
4443

4544
surveyId?: string | null;
4645
loiId?: string | null;
@@ -72,8 +71,9 @@ export class JobListItemComponent implements OnInit, OnDestroy {
7271
this.dataSource = new DynamicDataSource(this.treeControl, this.loiService);
7372

7473
effect(() => {
75-
this.surveyId = this.surveyIdSignal();
76-
this.loiId = this.loiIdSignal();
74+
const {surveyId, loiId} = this.urlParamsSignal();
75+
this.surveyId = surveyId;
76+
this.loiId = loiId;
7777
});
7878
}
7979

web/src/app/pages/main-page-container/main-page/main-page.component.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ import {TitleDialogComponent} from './title-dialog/title-dialog.component';
3939
styleUrls: ['./main-page.component.scss'],
4040
})
4141
export class MainPageComponent implements OnInit {
42-
private loiIdSignal = this.navigationService.getLoiId();
43-
private submissionIdSignal = this.navigationService.getSubmissionId();
42+
private urlParamsSignal = this.navigationService.getUrlParams();
4443

4544
activeSurvey$: Observable<Survey>;
4645
subscription: Subscription = new Subscription();
@@ -58,8 +57,7 @@ export class MainPageComponent implements OnInit {
5857
this.activeSurvey$ = this.surveyService.getActiveSurvey$();
5958

6059
effect(() => {
61-
const loiId = this.loiIdSignal();
62-
const submissionId = this.submissionIdSignal();
60+
const {loiId, submissionId} = this.urlParamsSignal();
6361
if (loiId) this.loiService.selectLocationOfInterest(loiId);
6462
if (submissionId) this.submissionService.selectSubmission(submissionId);
6563
});
@@ -84,14 +82,14 @@ export class MainPageComponent implements OnInit {
8482
);
8583
}
8684

87-
ngOnDestroy() {
88-
this.subscription.unsubscribe();
89-
}
90-
9185
private showTitleDialog() {
9286
this.dialog.open(TitleDialogComponent, {
9387
width: '500px',
9488
disableClose: true,
9589
});
9690
}
91+
92+
ngOnDestroy() {
93+
this.subscription.unsubscribe();
94+
}
9795
}

0 commit comments

Comments
 (0)