-
Notifications
You must be signed in to change notification settings - Fork 368
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
[Qeustion] Is it possible to set multiple values at once with the setFilter action? #601
Comments
I think you may be right, you'd need to call |
Thank you for the suggestion @JasonStoltz. I am working with an Elasticsearch based backend and working on a multi-value Select Facet view. Setting What I ended up was comparing new values to old values and then applying One more note though: it seems that |
Thanks for the insightful tips so far, @dbruvers and @JasonStoltz! To expand on the idea of making improvements to enable setting multiple filter values at once, is it possible to add another action that can set the entire request state? (perhaps called something like That new action will be helpful for batching multiple value changes at once even when they span across different dimensions (For example, changing multiple filters and searchTerm at once). @JasonStoltz, what is your thought on that idea? |
Hey all! Another way we could look at it is having a request builder pattern for when you need to make more than one change to search. For the above example it could be request()
.resetFilters()
.addFilter("states", "Alaska")
.addFilter("states", "Texas")
.setPagination(1)
.search() The advantages is that any further additions to the API can be exposed via new methods and also typed really nicely. Behind the scenes the existing API like |
Nice, I like that a lot. |
Please correct me if I am wrong but it seems like it is not possible to set multiple values at once with the
setFilter
action. Is that correct?The value is being wrapped in an array in this line making it impossible to pass an array as the value since that would be wrapped in an additional array.
The expected behavior would be that one can do either of these actions:
The later one ends up with a filter state of
which should be rather
The text was updated successfully, but these errors were encountered: