-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Add support for meta parameter in queries #7116
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Are we going to add support for a meta
prop on our components as well?
It reminds me of something 😅 (I know it's hard to maintain this framework, don't worry! I appreciate your work). |
We're adding meta to the As for the response, we're currently working on adding support for partial pagination (i.e. list responses with no |
OK that's nicer to have a well-defined API for the partial pagination, but I still think having a |
With the new Query API (using react-query), if you ever need to call your data provider with custom params and read the full response, it's super easy. I don't think we should handle that in core. |
That's good to know, it will be feasible to add custom behavior to components using data providers then, but I still think that it would be great if data are analyzed and returned with a special meta parameter by data providers, since it's their responsibility. |
I am curious about this as well. Our API only returns relations when asked (_embed) since we're using ra-data-json-server which uses _embed for that as well because that's the spec. Without that we can't use (and more specifically ReferenceArrayInput) and need a custom form. |
You don't need an embed to use ReferenceArrayInput. ReferenceArrayInput fetches the related data itself. |
@fzaninotto It doesn't seem to do that for edit. I mean, it fetches the options, sure. But it doesn't change anything to the getOne of the that tells the api to include the currently linked ids. |
Problem
The Data Provider vocabulary is restrictive. Sometimes, developers need to tweak the request for a particular request, by passing special parameters. They need to multiply resources and add code to the dataProvider because they can't pass additional parameters.
Solution
All Data Provider methods now accept a
meta
parameter. React-admin doesn't set this parameter by default in its queries, but it's a good way to pass special arguments or metadata to an API call.It's up to the Data Provider to interpret this parameter.