Is there a way to detect "is loading" for React InstantSearch Hooks?

Hi, when a page does its initial load, there’s a brief period where Algolia hasn’t populated the UI yet. Is there a way to detect if a query is in process and also finished?

useInstantSearch() feels like the right place to provide these.


This post was flagged by the community and is temporarily hidden.

If you’re using InstantSearch, you can monitor the SearchState for this.

Here’s an example of rolling-your-own loading indicator:

import {
} from 'react-instantsearch-dom'

const LoadingIndicator = connectStateResults(({ isSearchStalled }) =>
  isSearchStalled ? 'Loading...' : null

const App = () => (
  <InstantSearch indexName="instant_search" searchClient={searchClient}>
    <SearchBox />
    <LoadingIndicator />