From 6990afb5dfd3381aa0e510ef3a973c054aef3097 Mon Sep 17 00:00:00 2001 From: Dave Shanley Date: Tue, 1 Aug 2023 14:26:45 -0400 Subject: [PATCH] Fixed a few bugs with state-resetting, a forced page rebuild works well. Signed-off-by: Dave Shanley --- ui/src/components/controls/controls.ts | 2 +- ui/src/components/kv-view/kv-view.ts | 2 +- ui/src/components/transaction/transaction-container.ts | 6 +++--- ui/src/wiretap.ts | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/src/components/controls/controls.ts b/ui/src/components/controls/controls.ts index 0032f79..4b1bba6 100644 --- a/ui/src/components/controls/controls.ts +++ b/ui/src/components/controls/controls.ts @@ -92,7 +92,7 @@ export class WiretapControlsComponent extends LitElement { controlUpdateHandler(): BusCallback { return (msg: Message>) => { - const delay = msg.payload.payload.config.globalAPIDelay; + const delay = msg.payload.payload?.config.globalAPIDelay; const existingDelay = this._controls?.globalDelay; if (delay == undefined) { diff --git a/ui/src/components/kv-view/kv-view.ts b/ui/src/components/kv-view/kv-view.ts index 19ee7ed..d535279 100644 --- a/ui/src/components/kv-view/kv-view.ts +++ b/ui/src/components/kv-view/kv-view.ts @@ -32,7 +32,7 @@ export class KVViewComponent extends LitElement { } set data(value: Map) { - if (value.size > 0) { + if (value && value.size > 0) { this._data = value; } } diff --git a/ui/src/components/transaction/transaction-container.ts b/ui/src/components/transaction/transaction-container.ts index 432a4e6..11cb30b 100644 --- a/ui/src/components/transaction/transaction-container.ts +++ b/ui/src/components/transaction/transaction-container.ts @@ -209,7 +209,7 @@ export class HttpTransactionContainerComponent extends LitElement { let filtered: HttpTransactionItemComponent[] = this._transactionComponents; // filter by method - if (this._filters.filterMethod.keyword.length > 0) { + if (this._filters?.filterMethod.keyword.length > 0) { filtered = this._transactionComponents.filter( (v: HttpTransactionItemComponent) => { const filter = v.httpTransaction.matchesMethodFilter(this._filters); @@ -218,7 +218,7 @@ export class HttpTransactionContainerComponent extends LitElement { } // re-filter by keywords - if (this._filters.filterKeywords.length > 0) { + if (this._filters?.filterKeywords.length > 0) { filtered = filtered.filter((v: HttpTransactionItemComponent) => { const filter = v.httpTransaction.matchesKeywordFilter(this._filters); return filter != false; @@ -226,7 +226,7 @@ export class HttpTransactionContainerComponent extends LitElement { } // re-filter by chains - if (this._filters.filterChain.length > 0) { + if (this._filters?.filterChain.length > 0) { filtered = filtered.filter((v: HttpTransactionItemComponent) => { const filter = v.httpTransaction.containsActiveLink(this._filters); v.httpTransaction.containsChainLink = (filter != false); diff --git a/ui/src/wiretap.ts b/ui/src/wiretap.ts index 94bf256..b6910c4 100644 --- a/ui/src/wiretap.ts +++ b/ui/src/wiretap.ts @@ -311,6 +311,7 @@ export class WiretapComponent extends LitElement { this.violationsCount = 0; this.calcComplianceLevel(); localforage.clear() + window.location.reload() } render() {