[search bar] use afterviewinit instead of afterviewchecked

This commit is contained in:
nymkappa
2023-07-25 15:03:39 +09:00
parent 07b0f24cf1
commit 6d5be78dd0
4 changed files with 24 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
import { AfterViewChecked, ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { AfterViewInit, ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { share } from 'rxjs/operators';
import { INodesRanking } from '../../interfaces/node-api.interface';
@@ -12,7 +12,7 @@ import { LightningApiService } from '../lightning-api.service';
styleUrls: ['./lightning-dashboard.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class LightningDashboardComponent implements OnInit, AfterViewChecked {
export class LightningDashboardComponent implements OnInit, AfterViewInit {
statistics$: Observable<any>;
nodesRanking$: Observable<INodesRanking>;
officialMempoolSpace = this.stateService.env.OFFICIAL_MEMPOOL_SPACE;
@@ -30,7 +30,7 @@ export class LightningDashboardComponent implements OnInit, AfterViewChecked {
this.statistics$ = this.lightningApiService.getLatestStatistics$().pipe(share());
}
ngAfterViewChecked(): void {
ngAfterViewInit(): void {
this.stateService.focusSearchInputDesktop();
}
}