mirror of
https://github.com/fergalmoran/turnstone.git
synced 2025-12-22 09:49:56 +00:00
More robust checking for typeahead presence
This commit is contained in:
@@ -78,7 +78,6 @@ export default function Container(props) {
|
|||||||
const typeaheadInput = useRef(null)
|
const typeaheadInput = useRef(null)
|
||||||
|
|
||||||
// Calculated states
|
// Calculated states
|
||||||
console.log('hasTypeahead', typeahead, state.items.length > 1)
|
|
||||||
const hasTypeahead = typeahead && state.items.length > 1
|
const hasTypeahead = typeahead && state.items.length > 1
|
||||||
const hasClearButton = clearButton && !!state.query
|
const hasClearButton = clearButton && !!state.query
|
||||||
const hasCancelButton = cancelButton && hasFocus
|
const hasCancelButton = cancelButton && hasFocus
|
||||||
@@ -186,7 +185,8 @@ export default function Container(props) {
|
|||||||
// Immediately clearing both inputs prevents any slight
|
// Immediately clearing both inputs prevents any slight
|
||||||
// visual timing delays with async dispatch
|
// visual timing delays with async dispatch
|
||||||
queryInput.current.value = ''
|
queryInput.current.value = ''
|
||||||
if(typeahead) typeaheadInput.current.value = ''
|
if(typeahead && typeaheadInput.current)
|
||||||
|
typeaheadInput.current.value = ''
|
||||||
dispatch(clear())
|
dispatch(clear())
|
||||||
queryInput.current.focus()
|
queryInput.current.focus()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user