Browse Source

fix(ui): resolve type errors

pull/7325/head
KenTandrian 2 days ago
parent
commit
c5c798f2f3
  1. 8
      apps/client/src/app/components/home-holdings/home-holdings.component.ts
  2. 14
      libs/ui/src/lib/treemap-chart/treemap-chart.component.ts

8
apps/client/src/app/components/home-holdings/home-holdings.component.ts

@ -58,7 +58,7 @@ export class GfHomeHoldingsComponent implements OnInit {
protected hasImpersonationId: boolean;
protected hasPermissionToAccessHoldingsChart: boolean;
protected hasPermissionToCreateActivity: boolean;
protected holdings: PortfolioPosition[];
protected holdings: PortfolioPosition[] | undefined;
protected holdingType: HoldingType = 'ACTIVE';
protected readonly holdingTypeOptions: ToggleOption[] = [
{ label: $localize`Active`, value: 'ACTIVE' },
@ -181,8 +181,8 @@ export class GfHomeHoldingsComponent implements OnInit {
this.viewModeFormControl.setValue(
this.deviceType === 'mobile'
? GfHomeHoldingsComponent.DEFAULT_HOLDINGS_VIEW_MODE
: this.user?.settings?.holdingsViewMode ||
GfHomeHoldingsComponent.DEFAULT_HOLDINGS_VIEW_MODE,
: (this.user?.settings?.holdingsViewMode ??
GfHomeHoldingsComponent.DEFAULT_HOLDINGS_VIEW_MODE),
{ emitEvent: false }
);
} else if (this.holdingType === 'CLOSED') {
@ -192,7 +192,7 @@ export class GfHomeHoldingsComponent implements OnInit {
);
}
this.holdings = [];
this.holdings = undefined;
this.fetchHoldings()
.pipe(takeUntilDestroyed(this.destroyRef))

14
libs/ui/src/lib/treemap-chart/treemap-chart.component.ts

@ -56,7 +56,7 @@ export class GfTreemapChartComponent
@Input() colorScheme: ColorScheme;
@Input() cursor: string;
@Input() dateRange: DateRange;
@Input() holdings: PortfolioPosition[];
@Input() holdings: PortfolioPosition[] | undefined;
@Input() locale = getLocale();
@Output() treemapChartClicked = new EventEmitter<AssetProfileIdentifier>();
@ -70,15 +70,11 @@ export class GfTreemapChartComponent
Chart.register(LinearScale, Tooltip, TreemapController, TreemapElement);
}
public ngAfterViewInit() {
if (this.holdings) {
this.initialize();
}
this.initialize();
}
public ngOnChanges() {
if (this.holdings) {
this.initialize();
}
this.initialize();
}
public ngOnDestroy() {
@ -159,6 +155,10 @@ export class GfTreemapChartComponent
}
private initialize() {
if (!this.holdings) {
return;
}
this.isLoading = true;
const { endDate, startDate } = getIntervalFromDateRange({

Loading…
Cancel
Save