index.waitTask not waiting for index completion?

We are using algolia and firebase in our app, it’s working great.

Though we are running into an issue when adding indexes.

Our current flow is
add data > firebase dbListener picks up the changed data > indexes in algolia

Though we aren’t seeing the newly added item on our list. If we refresh the page, we see it.

We are using the refresh boolean to manage when it updates, but it’s not working.
We set a boolean in firebase before the indexing starts then updates that boolean when the index.waitTask has completed.
We then connect this boolean to the refresh boolean on instantSearch, no luck. If we use a setTimeout of 3000ms before we set the boolean to signify the completion of indexing, it works. If we use 1000ms, it doesn’t work.

We’d like to avoid having a refresh button if necessary, but it may be the only choice.

So what do you think?


Could you provide us a working example of your implementation? It will help a lot to better understand the issue. We provide template to avoid you the boilerplate part. You can find them on GitHub.