InstantSearch: hide results init

For #166 (closed)

Review Apps: http://docs-instantsearch-hide-results-init.178.62.207.141.xip.io/search/

What

Hide results from the search results page when the query is empty. Aka hide results on init.

Code block in layouts/instantsearch.html:

[...],
urlSync: true,
searchFunction: function(helper) {
    var searchResults = $('.search-results');
    if (helper.state.query === '') {
      searchResults.hide();
      return;
    }
    helper.search();
    searchResults.show();
  }
});
[...],

Problem

The reset button clears the search query but not the text input field: see review app.

Steps to reproduce:

  1. Visit http://docs-instantsearch-hide-results-init.178.62.207.141.xip.io/search/
  2. Type something to search
  3. Clear the search with the reset button (x)

The search query clears, but not the text input.

Edited by Marcia Ramos

Merge request reports

Loading