From 40c77033c0e6779f1095a0e81c6f45c666b897c8 Mon Sep 17 00:00:00 2001 From: Satbir Singh Date: Fri, 3 Apr 2020 10:45:57 +0530 Subject: [PATCH] Do not show error on autocomplete. --- .../editorComponents/DynamicAutocompleteInput.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/client/src/components/editorComponents/DynamicAutocompleteInput.tsx b/app/client/src/components/editorComponents/DynamicAutocompleteInput.tsx index 9a161a4701..5b0a833027 100644 --- a/app/client/src/components/editorComponents/DynamicAutocompleteInput.tsx +++ b/app/client/src/components/editorComponents/DynamicAutocompleteInput.tsx @@ -180,6 +180,7 @@ type Props = ReduxStateProps & type State = { isFocused: boolean; + autoCompleteVisible: boolean; }; class DynamicAutocompleteInput extends Component { @@ -190,6 +191,7 @@ class DynamicAutocompleteInput extends Component { super(props); this.state = { isFocused: false, + autoCompleteVisible: false, }; } @@ -319,7 +321,14 @@ class DynamicAutocompleteInput extends Component { const shouldShow = cursorBetweenBinding && !cm.state.completionActive; if (shouldShow) { AnalyticsUtil.logEvent("AUTO_COMPELTE_SHOW", {}); + this.setState({ + autoCompleteVisible: true, + }); cm.showHint(cm); + } else { + this.setState({ + autoCompleteVisible: false, + }); } } }; @@ -345,7 +354,8 @@ class DynamicAutocompleteInput extends Component { const hasError = !!(meta && meta.error); let showError = false; if (this.editor) { - showError = hasError && this.state.isFocused; + showError = + hasError && this.state.isFocused && !this.state.autoCompleteVisible; } return (