-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to update options on the fly, or exposing an API to re-initialize docsearch #608
Comments
After looking into the source code, I realized that it's already supported by modifying properties on the returned instance of the global |
Thanks for the update @Justineo Would you mind providing more details regarding what you wanted to achieve? If you can share with us a code example, we would be happy to include it within your documentation. |
I'm using a front-end router. After user navigates to a new URL that triggers locale change, I need to update the Something like: const instance = docsearch({ ... })
app.on('localechange', val => {
instance.algoliaOptions.facetFilters = [`lang:${val}`]
}) |
Furthermore, I found the
We'll still get the cached results. The data is cached inside the instance.autocomplete
.eq(0).data('aaAutocomplete')
.dropdown.datasets[0].clearCachedSuggestions()
instance.client.clearCache() |
Do you want to request a feature or report a bug?
Feature request. Following up #599 (comment).
My site uses a front-end router and I need docsearch to update options after user navigated to a new page from the front-end.
What is the current behavior?
The API only exposes an initialize function, lacking the ability to dispose or re-initialize from the front-end.
If the current behavior is a bug, please provide all the steps to reproduce and a minimal
JSFiddle example or a repository on GitHub that we can
npm install
and
npm start
.What is the expected behavior?
Docsearch can be re-initialized with different options, or setting new options on the fly.
The text was updated successfully, but these errors were encountered: