Hi! I’ve already searched around on the forum and docs but can’t seem to find the answer. This is my problem:
I have a media library and I’m using Instantsearch to display those as infinite-hits, and have some filters on them and it works fine. However, I have to implement a “Favourites” functionality. A user can mark one or more media as their favourite (I was thinking of saving the objectID’s of that media as a cookie) and should then be able to filter the list to display only their favourites. They can also toggle this filter off, and then the original infinite-hits should be displayed again.
I’m having trouble with re-rendering the infinite-hits widget, and would also love to know how to get the original state of it back after.
I came up with this code, and it does retreive the correct media, but I’m stuck on how to go from here:
function toggleFavourites(show) {
index
.search("", {
filters: `objectID:efff1bf0-90ce-4679-81d4-b790ea59bde1 OR objectID:f796fc92-6e68-4968-b2b0-c2b94a6295f5`
})
.then(content => {
//What to do here???
})
.catch(e => {
console.log('Error performing search: ', e)
})
}
Thanks in advance!!