-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
When having the search in something like a popup / modal I would like the search to reset when closing it. Unfortunately even tho my search component gets unmounted, the next time it gets mounted it already shows the previous result.
Another use case is that I want to reset the search when the input is empty.
Describe the solution you'd like
Add a useAlgoliaSearch should return a 'reset()` function that can be called e.g. onUnmounted().
Example:
const searchInput = ref('');
const { result, search, reset } = useAlgoliaSearch('products');
watchDebounced(
searchInput,
async () => {
if (searchInput.length < 4) {
reset();
return;
}
await search({
query: searchInput.value,
});
},
{ debounce: 200, maxWait: 500 },
);
onUnmounted(() => {
reset();
});Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request