mirror of
https://github.com/fergalmoran/turnstone.git
synced 2025-12-22 09:49:56 +00:00
Fix bug preventing clear button from working
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user