From 23332639d0db0f795fd2b2ca4d28605baed62836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Mert=20Y=C4=B1ld=C4=B1ran?= Date: Fri, 17 Dec 2021 17:26:36 +0300 Subject: [PATCH] Fix a JavaScript error in case of `null` attribute and an interface conversion error in the API server (#540) --- tap/extensions/amqp/helpers.go | 8 +++++++- ui/src/components/EntriesList.tsx | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tap/extensions/amqp/helpers.go b/tap/extensions/amqp/helpers.go index 188ae18a1..2c3a8b571 100644 --- a/tap/extensions/amqp/helpers.go +++ b/tap/extensions/amqp/helpers.go @@ -579,12 +579,18 @@ func representConnectionStart(event map[string]interface{}) []interface{} { } func representConnectionClose(event map[string]interface{}) []interface{} { + replyCode := "" + + if event["replyCode"] != nil { + replyCode = fmt.Sprintf("%g", event["replyCode"].(float64)) + } + rep := make([]interface{}, 0) details, _ := json.Marshal([]api.TableData{ { Name: "Reply Code", - Value: fmt.Sprintf("%g", event["replyCode"].(float64)), + Value: replyCode, Selector: `request.replyCode`, }, { diff --git a/ui/src/components/EntriesList.tsx b/ui/src/components/EntriesList.tsx index 14e78bec2..6b3a6917b 100644 --- a/ui/src/components/EntriesList.tsx +++ b/ui/src/components/EntriesList.tsx @@ -66,7 +66,7 @@ export const EntriesList: React.FC = ({entries, setEntries, qu } setIsLoadingTop(true); const data = await api.fetchEntries(leftOffTop, -1, query, 100, 3000); - if (!data || !data.meta) { + if (!data || data.data === null || data.meta === null) { setNoMoreDataTop(true); setIsLoadingTop(false); return;