Skip to content
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

updating querystring with query value #435

Open
mausinc opened this issue Feb 10, 2023 · 4 comments
Open

updating querystring with query value #435

mausinc opened this issue Feb 10, 2023 · 4 comments

Comments

@mausinc
Copy link

mausinc commented Feb 10, 2023

hi, thanks so much for the example.
i am trying to get this working with the query parameter in the url. is this possible?

i can find in the documentation of the autocomplete lib some information about state

 initialState: {
      // This uses the `search` query parameter as the initial query
      query: new URL(window.location).searchParams.get('query'),
    },
    
    onStateChange({ state }) {
      console.log(state);
    },
This doesn't seem to work in the selectize version. Any help would be great!
@Haroenv
Copy link
Contributor

Haroenv commented Feb 10, 2023

Sorry, what is the selectize version? these examples are for autocomplete v1, which doesn't have any specific versions for frameworks

@mausinc
Copy link
Author

mausinc commented Feb 10, 2023

@Haroenv
Copy link
Contributor

Haroenv commented Feb 10, 2023

You can do that using routing: https://codesandbox.io/s/wizardly-river-39g2ic?file=/src/app.js

@mausinc
Copy link
Author

mausinc commented Feb 13, 2023

thanks so much.
to give some background on our project, we worked with searcbbox and facets before. the querystring with query and refinementlist are essential. In the previous version we used below code for routing.

routing: {
  stateMapping: instantsearch.stateMappings.singleIndex(language.indexName)
}

After adding query suggestions, routing works but only for the facets. Adding routing:true to the suggestions method works and updates the url but overwrites the facets querystring value.
Not sure if this is the place to ask, but is it wise to combine autocomplete and facets? If yes how to proceed?
thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants