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

Fix GET_MANY in ra-data-json-server data provider returns too many results #2873

Merged

Conversation

paradoxxxzero
Copy link
Contributor

I think using the json-server like feature is not what we want here, since an id_like=2|33|444 will match 2, 33, 444 but also 23, 133 and so forth.
We could restrict the match with delimiters (^ and $) but since it supports multiple filters query, it would be simpler to use just that.

…lter instead of a greedy regular expression.
@fzaninotto
Copy link
Member

Are you sure this works? I tested the /posts?id=[1,2] URL on JSONPlaceholder but it doesn't seem to filter the list.

@paradoxxxzero
Copy link
Contributor Author

paradoxxxzero commented Feb 13, 2019

This is not /posts?id=[1,2] but /posts?id=1&id=2

> const {stringify} = require('query-string')
undefined
> stringify({id: [1, 2]})
'id=1&id=2'

@fzaninotto
Copy link
Member

Gotcha, thanks for the explanation.

@fzaninotto fzaninotto changed the title ra-data-json-server: GET_MANY query is too greedy Fix GET_MANY in ra-data-json-server data provider returns too many results Feb 15, 2019
@fzaninotto fzaninotto merged commit 459ba28 into marmelab:master Feb 15, 2019
@fzaninotto fzaninotto added this to the 2.7.2 milestone Feb 15, 2019
@fzaninotto
Copy link
Member

And thanks for the PR!

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.

2 participants