Skip to content

Commit 9bf297f

Browse files
authored
Fix search suggestions error for long search queries (#6955)
1 parent 7fbe4b2 commit 9bf297f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/renderer/helpers/api/local.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@ async function createInnertube({ withPlayer = false, location = undefined, safet
6363
})
6464
}
6565

66+
/** @type {Innertube | null} */
6667
let searchSuggestionsSession = null
6768

6869
export async function getLocalSearchSuggestions(query) {
70+
// The search suggestions endpoint does not like search queries larger than SEARCH_CHAR_LIMIT
71+
// so return an empty array instead
6972
if (query.length > SEARCH_CHAR_LIMIT) {
70-
// There's an event handler on the search input so avoid displaying an exception
71-
console.error(`Query is over ${SEARCH_CHAR_LIMIT} characters`)
72-
return
73+
return []
7374
}
7475

7576
// reuse innertube instance to keep the search suggestions snappy

0 commit comments

Comments
 (0)