Fix bug preventing clear button from working

This commit is contained in:
Tom Southall
2022-02-19 17:24:09 +00:00
parent 913156cfed
commit ec8a714f73
2 changed files with 3 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import * as types from './actionTypes'
import undef from '../utils/undef'
export const setQuery = (query) => {
console.log('setQuery', {query})
const payload = {
query,
selected: undef

View File

@@ -164,14 +164,13 @@ export default function Container(props) {
}
const handleClearButton = (evt) => {
console.log('handleClearButton')
evt.preventDefault()
clearState()
}
const clearState = () => {
dispatch(setQuery(queryInput.current.value))
setTimeout(() => queryInput.current.focus(), debounceWait) // TODO: Put in useEffect
dispatch(setQuery(''))
queryInput.current.focus()
}
const handleFocus = () => {