From 295653648b2962c9b71f78880927621b507e84f6 Mon Sep 17 00:00:00 2001 From: Vadim Ogievetsky Date: Thu, 20 Jul 2023 16:22:41 -0700 Subject: [PATCH] Web console: make typing fun again (#14632) * extract common function * make typing fun again --- .../src/react-table/react-table-inputs.tsx | 16 ++++++++++------ web-console/src/utils/date.ts | 4 ++++ .../execution-stages-pane.tsx | 3 ++- .../recent-query-task-panel.tsx | 9 +++++++-- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/web-console/src/react-table/react-table-inputs.tsx b/web-console/src/react-table/react-table-inputs.tsx index 4be942cd79f..50937750b38 100644 --- a/web-console/src/react-table/react-table-inputs.tsx +++ b/web-console/src/react-table/react-table-inputs.tsx @@ -41,7 +41,7 @@ interface FilterRendererProps { export function GenericFilterInput({ column, filter, onChange, key }: FilterRendererProps) { const [menuOpen, setMenuOpen] = useState(false); - const [focused, setFocused] = useState(false); + const [focusedText, setFocusedText] = useState(); const enableComparisons = String(column.headerClassName).includes('enable-comparisons'); @@ -53,7 +53,7 @@ export function GenericFilterInput({ column, filter, onChange, key }: FilterRend return ( } - value={needle} - onChange={e => onChange(combineModeAndNeedle(mode, e.target.value))} + value={focusedText ?? needle} + onChange={e => { + const enteredText = e.target.value; + setFocusedText(enteredText); + onChange(combineModeAndNeedle(mode, enteredText)); + }} rightElement={ filter ?