[Bugfix] On clicking Go to all datasources, UI renders the same compone… (#1930)

* fixes: On clicking Go to all datasources, UI renders the same component again

* fixes: modal datasource state update issue

* removes unwanted comments
This commit is contained in:
Arpit 2022-01-29 06:58:51 +05:30 committed by GitHub
parent 387433f0a4
commit dbc1e4d350
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -519,7 +519,7 @@ class DataSourceManager extends React.Component {
show={this.props.showDataSourceManagerModal}
size={selectedDataSource ? 'lg' : 'xl'}
onEscapeKeyDown={this.hideModal}
className={selectedDataSource ? 'mt-5 animation-fade' : 'mt-5 select-datasource-list-modal animation-fade'}
className={selectedDataSource ? 'animation-fade' : 'select-datasource-list-modal animation-fade'}
contentClassName={this.props.darkMode ? 'theme-dark' : ''}
animation={false}
onExit={this.onExit}
@ -771,6 +771,9 @@ const SearchBoxContainer = ({ onChange, onClear, queryString, activeDatasourceLi
}
}, [queryString]);
React.useEffect(() => {
if (searchText === '') {
onClear();
}
if (searchText) {
document.querySelector('.input-icon .form-control:not(:first-child)').style.paddingLeft = '0.5rem';
}
@ -778,6 +781,7 @@ const SearchBoxContainer = ({ onChange, onClear, queryString, activeDatasourceLi
return () => {
document.querySelector('.input-icon .form-control:not(:first-child)').style.paddingLeft = '2.5rem';
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [searchText]);
return (