react-instantsearch icon indicating copy to clipboard operation
react-instantsearch copied to clipboard

Applying filters in Configure also changes the filters refinement List

Open syedateeb1 opened this issue 3 years ago • 13 comments

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>

syedateeb1 avatar Jun 17 '21 11:06 syedateeb1

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!

Haroenv avatar Jun 17 '21 11:06 Haroenv

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

Haroenv avatar Jun 17 '21 11:06 Haroenv

Its Okay. to be more clarify i did not create new InstantSearch component in my Filter Component class.

syedateeb1 avatar Jun 17 '21 11:06 syedateeb1

How can we pass multiple attributes to virtual refinement widget?

syedateeb1 avatar Jun 17 '21 12:06 syedateeb1

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.

francoischalifour avatar Jun 17 '21 13:06 francoischalifour

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

syedateeb1 avatar Jun 18 '21 10:06 syedateeb1

I'm sorry i'm not good in explaining. But i really need the help :(

syedateeb1 avatar Jun 18 '21 10:06 syedateeb1

Can you make a sandbox with your code please @syedateeb1? We have a template available for that purpose here. Thanks!

Haroenv avatar Jun 18 '21 11:06 Haroenv

https://codesandbox.io/s/lucid-river-uux9x?file=/App.js

syedateeb1 avatar Jun 18 '21 12:06 syedateeb1

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

Haroenv avatar Jun 18 '21 12:06 Haroenv

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?

syedateeb1 avatar Jun 18 '21 12:06 syedateeb1

Is this still active or did anyone find a solution for this, I am facing the same problem. Thanks.

markosrx avatar Jul 13 '22 10:07 markosrx

@markosrx could you open a new issue with reproduction please?

Haroenv avatar Jul 13 '22 12:07 Haroenv

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.

sarahdayan avatar Dec 22 '22 13:12 sarahdayan