From 69d139286efcbefaa97d7ce9de59087f5af3a567 Mon Sep 17 00:00:00 2001 From: Matheus Silva Santos Date: Mon, 25 Mar 2019 17:20:27 -0300 Subject: [PATCH] correcting shameful bugs introduced by lack of tests --- components/ui/FilterModal.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/ui/FilterModal.js b/components/ui/FilterModal.js index e85b848..8dfaeca 100644 --- a/components/ui/FilterModal.js +++ b/components/ui/FilterModal.js @@ -60,9 +60,10 @@ class FilterModal extends Component { return } - this.setState({ query, invalidJsonAlertVisible: false }, () => + this.setState({ query, invalidJsonAlertVisible: false }, () => { + console.debug('calling back onFilterChange with filter', query) this.props.onFilterChange(this.state.query) - ) + }) } createSimpleFilter = () => { @@ -81,7 +82,7 @@ class FilterModal extends Component { return `(${qs.join(' OR ')})` } ) - return fields.length > 1 ? compile(fields.join(' AND ')) : {} + return fields.length > 0 ? compile(fields.join(' AND ')) : {} } createAdvancedFilter = () => { @@ -89,6 +90,7 @@ class FilterModal extends Component { // the query param does not support // anything but an obj in root level if (Array.isArray(query) || !(query instanceof Object)) throw SyntaxError + return query } handleSimpleFormChange = (key, value) => {