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' import undef from '../utils/undef'
export const setQuery = (query) => { export const setQuery = (query) => {
console.log('setQuery', {query})
const payload = { const payload = {
query, query,
selected: undef selected: undef

View File

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