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

global: updateQueryState support for multiple filters #102

Merged
merged 2 commits into from
Apr 2, 2020

Conversation

topless
Copy link
Member

@topless topless commented Apr 1, 2020

updateQueryState accepts only one filter a time. The intention of this pr is to be able to submit multiple filters at once. This is useful for example when we want to replace a filter.

@topless topless changed the title Submit multiple filters global: updateQueryState support for multiple filters Apr 1, 2020
@topless topless requested a review from ntarocco April 1, 2020 18:22
@topless topless self-assigned this Apr 1, 2020
@topless topless requested a review from zzacharo April 1, 2020 19:08
* e.g. query = [['file_type', 'pdf'], ['file_type', 'txt']]
*/
let tempStateFilters = stateFilters;
_forEach(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you do simply:

return queryFilters.filter(queryFilter => updateFilter(queryFilter. stateFilters))

?

Copy link
Member Author

@topless topless Apr 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was my initial approach but as we call updateFilter our stateFilters change, so our next updateFilter should be applied on the altered stateFilters and not the initial ones. I can explain in a call if needed.

@topless topless marked this pull request as ready for review April 2, 2020 11:00
Copy link
Contributor

@ntarocco ntarocco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this! 👍

- updateQueryState now also accepts array of filters as input
@zzacharo zzacharo merged commit b743069 into inveniosoftware:master Apr 2, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants