fix: shortcuts break when there are multiple queries (#4532)

This commit is contained in:
Vikrant Gupta 2024-02-13 01:40:11 +05:30 committed by GitHub
parent 6bc5ceac3e
commit 02f83e4b4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,9 +2,7 @@ import './QueryBuilderSearch.styles.scss';
import { Select, Spin, Tag, Tooltip } from 'antd';
import { OPERATORS } from 'constants/queryBuilder';
import { LogsExplorerShortcuts } from 'constants/shortcuts/logsExplorerShortcuts';
import { getDataTypes } from 'container/LogDetailedView/utils';
import { useKeyboardHotkeys } from 'hooks/hotkeys/useKeyboardHotkeys';
import {
useAutoComplete,
WhereClauseConfig,
@ -77,8 +75,6 @@ function QueryBuilderSearch({
searchKey,
);
const { registerShortcut, deregisterShortcut } = useKeyboardHotkeys();
const { handleRunQuery } = useQueryBuilder();
const onTagRender = ({
@ -204,18 +200,6 @@ function QueryBuilderSearch({
/* eslint-disable react-hooks/exhaustive-deps */
}, [sourceKeys]);
useEffect(() => {
registerShortcut(LogsExplorerShortcuts.FocusTheSearchBar, () => {
// set timeout is needed here else the select treats the hotkey as input value
setTimeout(() => {
selectRef.current?.focus();
}, 0);
});
return (): void =>
deregisterShortcut(LogsExplorerShortcuts.FocusTheSearchBar);
}, []);
return (
<div
style={{