Skip to content

Commit

Permalink
BIDS-2192: clear search when switching networks
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelsc committed Oct 23, 2023
1 parent ef87332 commit 8770aaf
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/tab-preferences/tab-preferences.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ export async function changeNetwork(

const newConfig = findConfigForKey(network)
await storage.clearCache()
await api.clearNetworkCache()
//await api.clearNetworkCache()
await validatorUtils.clearCache()

await storage.setNetworkPreferences(newConfig)
Expand Down
3 changes: 2 additions & 1 deletion src/app/tab-validators/tab-validators.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@

<ion-toolbar [style.--background]="selectMode ? 'var(--ion-color-primary)' : 'var(--ion-toolbar-background)'">
<ion-searchbar
*ngIf="!selectMode"
#searchbarRef
[class.hidden]="selectMode"
showCancelButton="focus"
enterkeyhint="search"
(search)="searchEvent($event)"
Expand Down
7 changes: 7 additions & 0 deletions src/app/tab-validators/tab-validators.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,10 @@ cdk-virtual-scroll-viewport {
margin-top: 55px;
margin-bottom: 10px;
}

.hidden {
height: 0;
width: 0;
overflow: hidden;
visibility: hidden;
}
10 changes: 8 additions & 2 deletions src/app/tab-validators/tab-validators.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
* // along with Beaconchain Dashboard. If not, see <http://www.gnu.org/licenses/>.
*/

import { Component } from '@angular/core'
import { Component, ViewChild } from '@angular/core'
import { ValidatorUtils, Validator, ValidatorState } from '../utils/ValidatorUtils'
import { ModalController, Platform } from '@ionic/angular'
import { IonSearchbar, ModalController, Platform } from '@ionic/angular'
import { ValidatordetailPage } from '../pages/validatordetail/validatordetail.page'
import { ApiService } from '../services/api.service'
import { AlertController } from '@ionic/angular'
Expand Down Expand Up @@ -67,6 +67,8 @@ export class Tab2Page {

selected = new Map<number, boolean>()

@ViewChild('searchbarRef', { static: true }) searchbarRef: IonSearchbar

constructor(
private validatorUtils: ValidatorUtils,
public modalController: ModalController,
Expand All @@ -81,6 +83,10 @@ export class Tab2Page {
public unit: UnitconvService
) {
this.validatorUtils.registerListener(() => {
if (this.searchResultMode && this.searchbarRef) {
this.searchResultMode = false
this.searchbarRef.value = null
}
this.refresh()
})
this.merchant.getCurrentPlanMaxValidator().then((result) => {
Expand Down

0 comments on commit 8770aaf

Please sign in to comment.