How to Refresh Hits after adding a new Object?
Hey,
I am displaying results in my Single Page Application with <Hits />.
After adding a new Page (including Indexing) I would like to trigger a refresh of the Hits.
client.clearCache() does not work.
Any hints?
Hello @tobiastheil,
I believe that unmounting your current InstantSearch instance and mounting a new one can do the trick.
Hey,
I have tried that. I have also tried adding a delay. Sometimes it works, sometimes is doesn't. The UX of it isn't that great.
Can I somehow trigger a search and then reset it?
My solution is that I hide the search when the query is empty. Instead of the
Can you share some code to help me see how you solve this?
<InstantSearch ...>
<SearchBoxWrapper>
<SearchBox
autofocus
placeholder='Type to search'
onFocus={this.onFocus}
onBlur={this.onBlur}
focusShortcuts={['s', '/', 191]}
/>
</SearchBoxWrapper>
{searchState.query !== '' ?
<Hits hitComponent={Note} />
:
<div>
{notesWithoutFolder.map(note =>
<Note key={note.id} hit={note} />
)}
</div>
}
</InstantSearch>