Hidden only when init

I try to hide my hit widget for the first search of my users, but only for the first search (it appears when the user type one letter or number).
After that first search, I want to show my entire database when the searchbox is empty again.

I began to create this blank hits container at the start with:

searchFunction: function (helper) {
        if (helper.state.query === '') {

It works well but after that I can’t have my entire database display back when I clear the searchbox as it is by default in IS (when the searchbox is empty, the last search appears)
Besides, my clear-all widget doesn’t work anymore.

Is there any solution ?

Hi @qbolgi,

Thanks for contacting Algolia!

Could you please use this InstantSearch sandbox to share the minimum code needed to reproduce your issue in its current state: instantsearch.js-app - CodeSandbox

I also want to make sure to understand your issue well, and it might be getting lost in the paragraphs above.

Could you please list step by step what your expectations are (e.g., 1. Type in query “XYZ”, 2. This happens, 3. Next thing happens).


Sure !

My expectations:

  1. You visit the page. Searchbox is empty. No results are visible.
  2. When you type a letter, results appears.
  3. When you clear the search in the searchbox, all database is visible (the default behavior of Instant Search I guess) whis is not the case in my solution (it displays the results of the last letter erased in the searchbox).

Any idea ? Just to hide results on page load but only that ?