How to use the algoliasearch-helper/src/url.getQueryStringFromState function in algoliasearch-helper

To help you get started, we’ve selected a few algoliasearch-helper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / react-instantsearch / src / lib / url-sync.js View on Github external
renderURLFromState(state) {
    const currentQueryString = this.urlUtils.readUrl();
    const foreignConfig = AlgoliaSearchHelper
      .getForeignConfigurationInQueryString(currentQueryString, {mapping: this.mapping});
    // eslint-disable-next-line camelcase
    foreignConfig.is_v = majorVersionNumber;

    const qs = urlHelper.getQueryStringFromState(
      state.filter(this.trackedParameters),
      {
        moreAttributes: foreignConfig,
        mapping: this.mapping,
        safe: true
      }
    );

    if (this.timer() < this.threshold) {
      this.urlUtils.replaceState(qs, {getHistoryState: this.getHistoryState});
    } else {
      this.urlUtils.pushState(qs, {getHistoryState: this.getHistoryState});
    }
  }