Skip to content

Commit

Permalink
Merge branch 'feat-blackstate-sql1' of https://github.com/preset-io/s…
Browse files Browse the repository at this point in the history
…uperset into feat-blackstate-sql1
  • Loading branch information
pkdotson committed Apr 15, 2022
2 parents bf36826 + 925e107 commit b628c7c
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,14 @@ export default function SqlEditorLeftBar({
// Ref needed to avoid infinite rerenders on handlers
// that require and modify the queryEditor
const queryEditorRef = useRef<QueryEditor>(queryEditor);
const [isDbSearch, setDbSearch] = useState(false);
const [emptyResultsWithSearch, setEmptyResultsWithSearch] = useState(false);

useEffect(() => {
queryEditorRef.current = queryEditor;
}, [queryEditor]);

const onDbSearch = (searchText?: string) => {
if (searchText) setDbSearch(true);
else setDbSearch(false);
const onEmptyResults = (searchText?: string) => {
setEmptyResultsWithSearch(!!searchText);
};

const onDbChange = ({ id: dbId }: { id: number }) => {
Expand Down Expand Up @@ -188,7 +187,7 @@ export default function SqlEditorLeftBar({
<EmptyStateSmall
image="empty.svg"
title={
isDbSearch
emptyResultsWithSearch
? t('No databases match your search')
: t('There are no databases available')
}
Expand Down Expand Up @@ -221,7 +220,7 @@ export default function SqlEditorLeftBar({
return (
<div className="SqlEditorLeftBar">
<TableSelectorMultiple
onEmptyResults={onDbSearch}
onEmptyResults={onEmptyResults}
emptyState={emptyStateComponent}
database={database}
getDbList={actions.setDatabases}
Expand Down

0 comments on commit b628c7c

Please sign in to comment.