fix(search): 🐛 abort search request if there are no query

This commit is contained in:
alistair3149 2023-07-07 20:44:45 -04:00
parent 4ef5376cab
commit 88a5d4de9d
No known key found for this signature in database

View file

@ -64,6 +64,11 @@ async function getResults( searchQuery, controller ) {
}
}
/* Abort early if there are no search query */
if ( searchQuery === '' ) {
return {};
}
const signal = controller.signal;
const response = await fetch( gateway.getUrl( searchQuery ), { signal } );