You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 with meta={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:
Indeed, <ReferenceManyField> should accept queryOptions with meta inside.
For now, you can use the beforeGetManyReference callback from the withLifecycleCallbacks helper to add meta:
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: