Skip to content

Commit 5a294b0

Browse files
refactor: TT-106 Delete exponentialGrowth variable in the TimeClock, ProjectListHover and EntryFields components
1 parent ff1af55 commit 5a294b0

File tree

3 files changed

+9
-24
lines changed

3 files changed

+9
-24
lines changed

src/app/modules/time-clock/components/entry-fields/entry-fields.component.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export class EntryFieldsComponent implements OnInit, OnDestroy {
3636
loadActivitiesSubscription: Subscription;
3737
loadActiveEntrySubscription: Subscription;
3838
actionSetDateSubscription: Subscription;
39-
exponentialGrowth;
4039

4140
constructor(
4241
private featureManagerService: FeatureManagerService,
@@ -177,9 +176,8 @@ export class EntryFieldsComponent implements OnInit, OnDestroy {
177176
}
178177

179178

180-
async ngOnDestroy():Promise<void> {
181-
this.exponentialGrowth = await this.isFeatureToggleActivated();
182-
if (this.exponentialGrowth) {
179+
ngOnDestroy(): void {
180+
if (this.isFeatureToggleActivated()) {
183181
this.loadActivitiesSubscription.unsubscribe();
184182
this.loadActiveEntrySubscription.unsubscribe();
185183
this.actionSetDateSubscription.unsubscribe();
@@ -188,9 +186,6 @@ export class EntryFieldsComponent implements OnInit, OnDestroy {
188186

189187
isFeatureToggleActivated() {
190188
return this.featureManagerService.isToggleEnabledForUser('exponential-growth').pipe(
191-
map((enabled) => {
192-
return enabled === true ? true : false;
193-
})
194-
).toPromise();
189+
map((enabled) => enabled));
195190
}
196191
}

src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export class ProjectListHoverComponent implements OnInit, OnDestroy {
2727
isLoading$: Observable<boolean>;
2828
projectsSubscription: Subscription;
2929
activeEntrySubscription: Subscription;
30-
exponentialGrowth;
3130

3231
constructor(private featureManagerService: FeatureManagerService,
3332
private formBuilder: FormBuilder, private store: Store<ProjectState>,
@@ -110,9 +109,8 @@ export class ProjectListHoverComponent implements OnInit, OnDestroy {
110109
}
111110
}
112111

113-
async ngOnDestroy(): Promise<void> {
114-
this.exponentialGrowth = await this.isFeatureToggleActivated();
115-
if(this.exponentialGrowth){
112+
ngOnDestroy(): void {
113+
if(this.isFeatureToggleActivated()){
116114
this.projectsSubscription.unsubscribe();
117115
this.activeEntrySubscription.unsubscribe();
118116
}
@@ -121,9 +119,6 @@ export class ProjectListHoverComponent implements OnInit, OnDestroy {
121119

122120
isFeatureToggleActivated() {
123121
return this.featureManagerService.isToggleEnabledForUser('exponential-growth').pipe(
124-
map((enabled) => {
125-
return enabled === true ? true : false;
126-
})
127-
).toPromise();
122+
map((enabled) => enabled));
128123
}
129124
}

src/app/modules/time-clock/pages/time-clock.component.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export class TimeClockComponent implements OnInit, OnDestroy {
2424
activeTimeEntry: Entry;
2525
clockOutSubscription: Subscription;
2626
storeSubscription: Subscription;
27-
exponentialGrowth;
2827

2928
constructor(
3029
private featureManagerService: FeatureManagerService,
@@ -73,19 +72,15 @@ export class TimeClockComponent implements OnInit, OnDestroy {
7372
}
7473
}
7574

76-
async ngOnDestroy(): Promise<void> {
77-
this.exponentialGrowth = await this.isFeatureToggleActivated();
78-
this.exponentialGrowth && this.storeSubscription.unsubscribe();
75+
ngOnDestroy(): void {
76+
this.isFeatureToggleActivated() && this.storeSubscription.unsubscribe();
7977
this.clockOutSubscription.unsubscribe();
8078
this.storeSubscription.unsubscribe();
8179
}
8280

8381
isFeatureToggleActivated() {
8482
return this.featureManagerService.isToggleEnabledForUser('exponential-growth').pipe(
85-
map((enabled) => {
86-
return enabled === true ? true : false;
87-
})
88-
).toPromise();
83+
map((enabled) => enabled));
8984
}
9085
}
9186

0 commit comments

Comments
 (0)