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 a meta prop to react-admin reference components #9669
Comments
Thanks for this report. Indeed, const dataProvider = withLifecycleCallbacks(baseDataProvider, [
{
resource: 'comments',
beforeGetManyReference: async params => {
return { ...params, meta: { orm: true } };
},
},
]); Feel free to open a PR if you come up with a fix of your own. 🙏 (the |
Running into this one again. While coding I intuitively add it but I seem to keep forgetting there isn't a queryOptions in ReferenceManyField... It's unfortunate that RA4 is not going to have this feature, since all PR's need to have the next branch as base. Instead I will use useGetManyReference and iterate the data. |
Is your feature request related to a problem? Please describe.
I need to pass a boolean flag to the backend when using ReferenceManyField.
Describe the solution you'd like
A meta prop that can be used to send data in the request using the optional meta parameter in the dataProvider.
i.e.
<ReferenceManyField ... meta={orm: true}>
would result in a referenceMany() call withmeta={orm: true}
.Describe alternatives you've considered
As a simple workaround, I've instead done
filter={'__meta__': {orm: true}}
and then popped it out of the filters in the backend. Though this is a bit of a hack and makes the code less maintainable.Based on the documentation, it makes it sound like the recommendation is to write a custom component. For such a simple thing, this appears to require copying hundreds of lines of code out of react-admin and maintaining it, which doesn't seem like a viable solution.
The text was updated successfully, but these errors were encountered: