fix: tweak autosuggest error logging and resetting (#1572)
This commit is contained in:
parent
d580a9b7e8
commit
2bafaa455e
|
@ -73,13 +73,17 @@ export function doAccountSearch (searchText) {
|
|||
})
|
||||
}
|
||||
|
||||
function onError (err) {
|
||||
console.warn('ignored autosuggest error', err)
|
||||
}
|
||||
|
||||
scheduleIdleTask(() => {
|
||||
if (canceled) {
|
||||
return
|
||||
}
|
||||
// run the two searches in parallel
|
||||
searchAccountsLocally().then(onNewResults)
|
||||
searchAccountsRemotely().then(onNewResults)
|
||||
searchAccountsLocally().then(onNewResults).catch(onError)
|
||||
searchAccountsRemotely().then(onNewResults).catch(onError)
|
||||
})
|
||||
|
||||
return {
|
||||
|
|
|
@ -33,12 +33,16 @@ export function doHashtagSearch (searchText) {
|
|||
}
|
||||
|
||||
scheduleIdleTask(async () => {
|
||||
try {
|
||||
const results = await requestThrottler.request()
|
||||
store.setForCurrentAutosuggest({
|
||||
autosuggestType: 'hashtag',
|
||||
autosuggestSelected: 0,
|
||||
autosuggestSearchResults: results
|
||||
})
|
||||
} catch (err) {
|
||||
console.warn('ignored autosuggest error', err)
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
|
|
|
@ -24,10 +24,10 @@ export function autosuggestObservers () {
|
|||
const { composeFocused } = store.get()
|
||||
const autosuggestSelecting = store.getForCurrentAutosuggest('autosuggestSelecting')
|
||||
if (!composeFocused || !autosuggestSearchText || autosuggestSelecting) {
|
||||
resetAutosuggest()
|
||||
return
|
||||
}
|
||||
|
||||
resetAutosuggest()
|
||||
if (autosuggestSearchText.startsWith(':')) { // emoji
|
||||
lastSearch = doEmojiSearch(autosuggestSearchText)
|
||||
} else if (autosuggestSearchText.startsWith('#')) { // hashtag
|
||||
|
|
Loading…
Reference in a new issue