Refresh Algolia <InstantSearch> Indices in React Native

I’m trying to refresh Algolia indices via on a React Native project but the list on React Native does not refresh the list when new objects are inserted into the Algolia index. I can see the index being updated on the Indices dashboard on Algolia website but not on mobile.

Any help is much appreciated.

The prop to “refresh” the list is “refresh={boolean}”.

Code example:

import { InstantSearch } from 'react-instantsearch-hooks'

const [refresh, setRefresh] = useState(false);

const updateList = () => {
    setRefresh=(true);
}

<InstantSearch
    indexName={"algolia-index"}
    searchClient={searchClient}  
    refresh={refresh}
>
.......
<Button
  onPress={updateList}
></Button>

For anyone trying to refresh their infinite hits on a react native project using react-instantsearch-hooks, unfortunately the refresh={true} prop does not work. Even though they recommend to upgrade AND it also states that IT IS compatible with React Native.

“In React InstantSearch Hooks refresh is a function returned from useInstantSearch, but it indeed doesn’t clear the infinite hits cache either. Sorry!”

1 Like

If anyone has any hacks and or workarounds, first round of beer or coffee is on me…

Thanks for reposting the issue here. If I think of a workaround I’ll come back to it, but I don’t have any ideas right now.