You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2020/04/20 11:55:03 UTC

[couchdb-fauxton] branch master updated: Query results fail to load when stats field is missing

This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git


The following commit(s) were added to refs/heads/master by this push:
     new 2aa4b3c  Query results fail to load when stats field is missing
2aa4b3c is described below

commit 2aa4b3c1c427ee7f974e14fba5fe01f12abdeb89
Author: Antonio Maranhao <an...@gmail.com>
AuthorDate: Fri Apr 17 16:40:58 2020 -0400

    Query results fail to load when stats field is missing
    
    Adds an extra check to prevent throwing a TypeError when the
    stats response does not have one of the expected fields.
---
 app/addons/documents/mango/components/ExecutionStats.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/addons/documents/mango/components/ExecutionStats.js b/app/addons/documents/mango/components/ExecutionStats.js
index 5c043d1..48b815a 100644
--- a/app/addons/documents/mango/components/ExecutionStats.js
+++ b/app/addons/documents/mango/components/ExecutionStats.js
@@ -53,8 +53,11 @@ export default class ExecutionStats extends React.Component {
   }
 
   executionStatsLine(title, value, alwaysShow = false, units = "") {
-    const hasValue = value === 0 && !alwaysShow ? "false" : "true";
-    return <div data-status={hasValue}>{title + ": "}<span className="value">{value.toLocaleString()} {units}</span></div>;
+    if (typeof value === 'number') {
+      const hasValue = value === 0 && !alwaysShow ? "false" : "true";
+      return <div data-status={hasValue}>{title + ": "}<span className="value">{value.toLocaleString()} {units}</span></div>;
+    }
+    return null;
   }
 
   executionStatsPopupComponent(executionStats) {