Skip to content

Commit

Permalink
Show loading indicator when typing in search view
Browse files Browse the repository at this point in the history
  • Loading branch information
JRomainG committed Dec 27, 2023
1 parent 80a80f3 commit 7caf055
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export default function Search() {

const abort = new AbortController();

setResults([]);
setStatus(SearchStatus.Loading);
const timeout = setTimeout(() => {
setResults([]);
setStatus(SearchStatus.Loading);
searchTracks(query)
.then((results) => {
if (!abort.signal.aborted) {
Expand All @@ -46,7 +46,7 @@ export default function Search() {
}
console.error;
});
}, 100);
}, 300);

return () => {
abort.abort();
Expand Down

0 comments on commit 7caf055

Please sign in to comment.