From 8770aaf3ff89a1fdea9624f6670d8a1a10e16669 Mon Sep 17 00:00:00 2001 From: Manuel <5877862+manuelsc@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:28:49 +0200 Subject: [PATCH] BIDS-2192: clear search when switching networks --- src/app/tab-preferences/tab-preferences.page.ts | 2 +- src/app/tab-validators/tab-validators.page.html | 3 ++- src/app/tab-validators/tab-validators.page.scss | 7 +++++++ src/app/tab-validators/tab-validators.page.ts | 10 ++++++++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/app/tab-preferences/tab-preferences.page.ts b/src/app/tab-preferences/tab-preferences.page.ts index 25790cb9..b3355650 100644 --- a/src/app/tab-preferences/tab-preferences.page.ts +++ b/src/app/tab-preferences/tab-preferences.page.ts @@ -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) diff --git a/src/app/tab-validators/tab-validators.page.html b/src/app/tab-validators/tab-validators.page.html index 839336ca..0a533e4a 100644 --- a/src/app/tab-validators/tab-validators.page.html +++ b/src/app/tab-validators/tab-validators.page.html @@ -38,7 +38,8 @@ . */ -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' @@ -67,6 +67,8 @@ export class Tab2Page { selected = new Map() + @ViewChild('searchbarRef', { static: true }) searchbarRef: IonSearchbar + constructor( private validatorUtils: ValidatorUtils, public modalController: ModalController, @@ -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) => {