react-instantsearch
react-instantsearch copied to clipboard
Applying filters in Configure also changes the filters refinement List
Hey i'm apply filters in Configure component and Search results are showing according to filters. But when i again open the filters list its also changes . I dont know why
<InstantSearch searchClient={searchClient} indexName={index} searchState = {searchState} onSearchStateChange = {onSearchStateChange}>
<Configure
index={index}
query={query}
filters={filters}
/>
<Container onStartShouldSetResponder={() => setShowSort(false)}>
<Filters setFilters={setFilters} showFilters = {showFilters} setShowFilters = {setShowFilters}/>
<InfiniteHits />
</Container>
</InstantSearch>
I don't understand what you mean? If this is related to your previous opened issue, this is because the facet count when you add it with filters
will mean "all facets that can still be applied if this filters are applied". If you don't have arrays of facet values, that will be only the facets/values that you put in filters.
The correct way to make this interface is using disjunctive filters, which is done if you use a virtual refinement list, as said in the previous issue. I don't understand why that's not possible for you.
Thanks!
Very sorry, I confused you with someone else that had the exact same question that also used the default profile picture here: https://github.com/algolia/react-instantsearch/issues/3064
Its Okay. to be more clarify i did not create new InstantSearch component in my Filter Component class.
How can we pass multiple attributes to virtual refinement widget?
Not sure what you want to do, but you can add as many virtual RefinementList
components as necessary in your tree—each with an attribute.
I know that. Let me rephrase the issue i'm getting When i apply a filter from my filter modal then it applies to my search results. But When i reopen my filter modal, i am not able to see what filter i have previously selected. It was working fine before when i was using new InstantSearch component in my Fitler modal. I remove it so there will be only one InstantSearch used in my code. After that this issue arrived
I'm sorry i'm not good in explaining. But i really need the help :(
Can you make a sandbox with your code please @syedateeb1? We have a template available for that purpose here. Thanks!
https://codesandbox.io/s/lucid-river-uux9x?file=/App.js
You were very close with that implementation, but just needed to add onSearchStateChange & searchState to the root InstantSearch instance: https://codesandbox.io/s/gracious-voice-ebcoz
see also https://www.algolia.com/doc/guides/building-search-ui/going-further/native/react/?language=react#create-a-modal and https://github.com/algolia/react-instantsearch/issues/892
Is it possible without having InstantSearch in filters modal? As filter component is already inside InstantSearch. Then why we have to again declare it in filter component too?
Is this still active or did anyone find a solution for this, I am facing the same problem. Thanks.
@markosrx could you open a new issue with reproduction please?
Hey!
We're doing a round of clean up before migrating this repository to the new InstantSearch monorepo. This issue seems not to have generated much activity lately and to be mostly solved, so we're going to close it.