Hey Guys, I have instant search question i’ve been...
# community-help
d
Hey Guys, I have instant search question i’ve been googling but didn’t get any results - is it possible to destroy an instant search instance ? Use case is i have a menu of collections and I want to destroy and re-init the instant search instance
j
Could you try the standard JS delete keyword?
d
Do you mean to delete the widgets and hits manually ?
j
Yeah, but I'm wondering if just deleting the main instantsearch object would suffice
d
Tried deleting main instantSeach object - that hasnt worked, and i am a bit wary of deleting manually as something might be skipped or overlooked
j
What if you just assign a new instantsearch instance to the existing variable? May be the automated GC will take care of deleting the necessary stuff then
d
Tried doing that - hasnt worked, the widgets from previous instance still remain
j
d
Thanks will check it out and will update here if i find a better solution too
Cheers
👍 1
Hi, again so if anyone comes across this thread, using the dispose method will work to remove all widgets from the search instance https://www.algolia.com/doc/api-reference/widgets/instantsearch/js/#widget-param-dispose
j
Good to know! Thanks Digamber!