Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Refactor cd to changeDetectorRef (#118)

Thomas95bcdea69be2
diff --git a/apps/client/src/app/app.component.ts b/apps/client/src/app/app.component.ts
index f7d5ccff97..339d4712a7 100644
--- a/apps/client/src/app/app.component.ts
+++ b/apps/client/src/app/app.component.ts
@@ -37,7 +37,7 @@ export class AppComponent implements OnDestroy, OnInit {
private unsubscribeSubject = new Subject<void>();
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private deviceService: DeviceDetectorService,
private materialCssVarsService: MaterialCssVarsService,
@@ -80,7 +80,7 @@ export class AppComponent implements OnDestroy, OnInit {
this.user = null;
}
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
}
diff --git a/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts b/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts
index e6f3acede3..4086669c6e 100644
--- a/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts
+++ b/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts
@@ -28,7 +28,7 @@ export class PerformanceChartDialog {
public title: string;
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
public dialogRef: MatDialogRef<PerformanceChartDialog>,
@Inject(MAT_DIALOG_DATA) public data: PositionDetailDialogParams
@@ -75,7 +75,7 @@ export class PerformanceChartDialog {
}
});
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
this.title = `Performance vs. ${this.benchmarkLabel}`;
diff --git a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts
index 4597b12ce8..161d45399a 100644
--- a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts
+++ b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts
@@ -34,7 +34,7 @@ export class PositionDetailDialog {
public transactionCount: number;
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
public dialogRef: MatDialogRef<PositionDetailDialog>,
@Inject(MAT_DIALOG_DATA) public data: PositionDetailDialogParams
@@ -127,7 +127,7 @@ export class PositionDetailDialog {
this.benchmarkDataItems[0].value = this.averagePrice;
}
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
);
}
diff --git a/apps/client/src/app/pages/about/about-page.component.ts b/apps/client/src/app/pages/about/about-page.component.ts
index 0d9db45a5e..03d684d469 100644
--- a/apps/client/src/app/pages/about/about-page.component.ts
+++ b/apps/client/src/app/pages/about/about-page.component.ts
@@ -25,7 +25,7 @@ export class AboutPageComponent implements OnInit {
* @constructor
*/
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private userService: UserService
) {}
@@ -39,7 +39,7 @@ export class AboutPageComponent implements OnInit {
if (state?.user) {
this.user = state.user;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
});
}
diff --git a/apps/client/src/app/pages/account/account-page.component.ts b/apps/client/src/app/pages/account/account-page.component.ts
index fb25010c91..ed70a2561b 100644
--- a/apps/client/src/app/pages/account/account-page.component.ts
+++ b/apps/client/src/app/pages/account/account-page.component.ts
@@ -28,7 +28,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
* @constructor
*/
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private userService: UserService
) {
@@ -55,7 +55,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
permissions.updateUserSettings
);
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
});
}
@@ -85,7 +85,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
.subscribe((user) => {
this.user = user;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
});
}
@@ -102,7 +102,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
.subscribe((response) => {
this.accesses = response;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
}
}
diff --git a/apps/client/src/app/pages/accounts/accounts-page.component.ts b/apps/client/src/app/pages/accounts/accounts-page.component.ts
index b86e8599bb..a2de77c268 100644
--- a/apps/client/src/app/pages/accounts/accounts-page.component.ts
+++ b/apps/client/src/app/pages/accounts/accounts-page.component.ts
@@ -35,7 +35,7 @@ export class AccountsPageComponent implements OnInit {
* @constructor
*/
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private deviceService: DeviceDetectorService,
private dialog: MatDialog,
@@ -90,7 +90,7 @@ export class AccountsPageComponent implements OnInit {
permissions.deleteAccount
);
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
});
@@ -105,7 +105,7 @@ export class AccountsPageComponent implements OnInit {
this.router.navigate([], { queryParams: { createDialog: true } });
}
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
}
diff --git a/apps/client/src/app/pages/admin/admin-page.component.ts b/apps/client/src/app/pages/admin/admin-page.component.ts
index c715983d82..79a739d027 100644
--- a/apps/client/src/app/pages/admin/admin-page.component.ts
+++ b/apps/client/src/app/pages/admin/admin-page.component.ts
@@ -32,7 +32,7 @@ export class AdminPageComponent implements OnInit {
public constructor(
private adminService: AdminService,
private cacheService: CacheService,
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private userService: UserService
) {}
@@ -139,7 +139,7 @@ export class AdminPageComponent implements OnInit {
this.transactionCount = transactionCount;
this.userCount = userCount;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
);
}
diff --git a/apps/client/src/app/pages/analysis/analysis-page.component.ts b/apps/client/src/app/pages/analysis/analysis-page.component.ts
index 7d68b6f12f..541f7cffc0 100644
--- a/apps/client/src/app/pages/analysis/analysis-page.component.ts
+++ b/apps/client/src/app/pages/analysis/analysis-page.component.ts
@@ -40,7 +40,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
* @constructor
*/
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private deviceService: DeviceDetectorService,
private impersonationStorageService: ImpersonationStorageService,
@@ -66,7 +66,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
.subscribe((response) => {
this.portfolioItems = response;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
this.dataService
@@ -76,7 +76,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
this.portfolioPositions = response;
this.initializeAnalysisData(this.portfolioPositions, this.period);
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
this.userService.stateChanged
@@ -85,7 +85,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
if (state?.user) {
this.user = state.user;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
});
}
diff --git a/apps/client/src/app/pages/home/home-page.component.ts b/apps/client/src/app/pages/home/home-page.component.ts
index df1f1397ea..966ecd86cd 100644
--- a/apps/client/src/app/pages/home/home-page.component.ts
+++ b/apps/client/src/app/pages/home/home-page.component.ts
@@ -58,7 +58,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
* @constructor
*/
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private deviceService: DeviceDetectorService,
private dialog: MatDialog,
@@ -94,7 +94,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
.subscribe(({ marketPrice }) => {
this.fearAndGreedIndex = marketPrice;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
}
@@ -103,7 +103,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
permissions.readForeignPortfolio
);
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
});
}
@@ -169,7 +169,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
};
});
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
this.dataService
@@ -178,14 +178,14 @@ export class HomePageComponent implements OnDestroy, OnInit {
this.performance = response;
this.isLoadingPerformance = false;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
this.dataService.fetchPortfolioOverview().subscribe((response) => {
this.overview = response;
this.isLoadingOverview = false;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
this.dataService
@@ -195,9 +195,9 @@ export class HomePageComponent implements OnDestroy, OnInit {
this.hasPositions =
this.positions && Object.keys(this.positions).length > 0;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
}
diff --git a/apps/client/src/app/pages/login/login-page.component.ts b/apps/client/src/app/pages/login/login-page.component.ts
index d2a6f198f2..ba3ea827ce 100644
--- a/apps/client/src/app/pages/login/login-page.component.ts
+++ b/apps/client/src/app/pages/login/login-page.component.ts
@@ -26,7 +26,7 @@ export class LoginPageComponent implements OnDestroy, OnInit {
* @constructor
*/
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private dialog: MatDialog,
private router: Router,
@@ -42,7 +42,7 @@ export class LoginPageComponent implements OnDestroy, OnInit {
this.initializeLineChart();
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
}
diff --git a/apps/client/src/app/pages/login/show-access-token-dialog/show-access-token-dialog.component.ts b/apps/client/src/app/pages/login/show-access-token-dialog/show-access-token-dialog.component.ts
index b68f8b52d9..b3f987398c 100644
--- a/apps/client/src/app/pages/login/show-access-token-dialog/show-access-token-dialog.component.ts
+++ b/apps/client/src/app/pages/login/show-access-token-dialog/show-access-token-dialog.component.ts
@@ -16,7 +16,7 @@ export class ShowAccessTokenDialog {
public isAgreeButtonDisabled = true;
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
@Inject(MAT_DIALOG_DATA) public data: any
) {}
@@ -26,7 +26,7 @@ export class ShowAccessTokenDialog {
setTimeout(() => {
this.isAgreeButtonDisabled = false;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}, 1500);
}
}
diff --git a/apps/client/src/app/pages/pricing/pricing-page.component.ts b/apps/client/src/app/pages/pricing/pricing-page.component.ts
index 650baa890c..fe4a4df8b0 100644
--- a/apps/client/src/app/pages/pricing/pricing-page.component.ts
+++ b/apps/client/src/app/pages/pricing/pricing-page.component.ts
@@ -21,7 +21,7 @@ export class PricingPageComponent implements OnInit {
* @constructor
*/
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private userService: UserService
) {}
@@ -35,7 +35,7 @@ export class PricingPageComponent implements OnInit {
if (state?.user) {
this.user = state.user;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
});
}
diff --git a/apps/client/src/app/pages/report/report-page.component.ts b/apps/client/src/app/pages/report/report-page.component.ts
index 4f6e3d0e40..2e4f062f3c 100644
--- a/apps/client/src/app/pages/report/report-page.component.ts
+++ b/apps/client/src/app/pages/report/report-page.component.ts
@@ -20,7 +20,7 @@ export class ReportPageComponent implements OnInit {
* @constructor
*/
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService
) {}
@@ -38,7 +38,7 @@ export class ReportPageComponent implements OnInit {
portfolioReport.rules['currencyClusterRisk'] || null;
this.feeRules = portfolioReport.rules['fees'] || null;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
}
diff --git a/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts b/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts
index 798eab8e5e..cf942cc9cd 100644
--- a/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts
+++ b/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts
@@ -42,7 +42,7 @@ export class CreateOrUpdateTransactionDialog {
private unsubscribeSubject = new Subject<void>();
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
public dialogRef: MatDialogRef<CreateOrUpdateTransactionDialog>,
@Inject(MAT_DIALOG_DATA) public data: CreateOrUpdateTransactionDialogParams
@@ -73,7 +73,7 @@ export class CreateOrUpdateTransactionDialog {
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe(({ marketPrice }) => {
this.currentMarketPrice = marketPrice;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
}
}
@@ -100,7 +100,7 @@ export class CreateOrUpdateTransactionDialog {
this.isLoading = false;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
}
diff --git a/apps/client/src/app/pages/transactions/transactions-page.component.ts b/apps/client/src/app/pages/transactions/transactions-page.component.ts
index ba38adface..684535d6b7 100644
--- a/apps/client/src/app/pages/transactions/transactions-page.component.ts
+++ b/apps/client/src/app/pages/transactions/transactions-page.component.ts
@@ -35,7 +35,7 @@ export class TransactionsPageComponent implements OnInit {
* @constructor
*/
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private deviceService: DeviceDetectorService,
private dialog: MatDialog,
@@ -90,7 +90,7 @@ export class TransactionsPageComponent implements OnInit {
permissions.deleteOrder
);
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
});
@@ -105,7 +105,7 @@ export class TransactionsPageComponent implements OnInit {
this.router.navigate([], { queryParams: { createDialog: true } });
}
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
}
diff --git a/apps/client/src/app/pages/zen/zen-page.component.ts b/apps/client/src/app/pages/zen/zen-page.component.ts
index 83596f7fee..ccb71b0637 100644
--- a/apps/client/src/app/pages/zen/zen-page.component.ts
+++ b/apps/client/src/app/pages/zen/zen-page.component.ts
@@ -31,7 +31,7 @@ export class ZenPageComponent implements OnDestroy, OnInit {
* @constructor
*/
public constructor(
- private cd: ChangeDetectorRef,
+ private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private deviceService: DeviceDetectorService,
private impersonationStorageService: ImpersonationStorageService,
@@ -48,7 +48,7 @@ export class ZenPageComponent implements OnDestroy, OnInit {
permissions.readForeignPortfolio
);
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
});
}
@@ -86,7 +86,7 @@ export class ZenPageComponent implements OnDestroy, OnInit {
};
});
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
this.dataService
@@ -95,9 +95,9 @@ export class ZenPageComponent implements OnDestroy, OnInit {
this.performance = response;
this.isLoadingPerformance = false;
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
});
- this.cd.markForCheck();
+ this.changeDetectorRef.markForCheck();
}
}