From 42efd5bc9a6be1c046929970dcae57fcdc68a98a Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sun, 6 Jan 2019 18:03:11 -0800 Subject: [PATCH] Fix use before definition Signed-off-by: Mcat12 --- src/components/log/QueryLog.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/log/QueryLog.js b/src/components/log/QueryLog.js index 5003fd6..8836710 100644 --- a/src/components/log/QueryLog.js +++ b/src/components/log/QueryLog.js @@ -29,7 +29,15 @@ class QueryLog extends Component { loading: false, atEnd: false, filtersChanged: false, - filters: [ + filters: [] + }; + + constructor(props) { + super(props); + + // This happens in the constructor to avoid using dateRanges before it's + // created + this.state.filters = [ { id: "time", value: { @@ -37,8 +45,8 @@ class QueryLog extends Component { end: dateRanges.Today[1] } } - ] - }; + ]; + } componentWillUnmount() { if (this.updateHandler) {