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.
By default, a <ReferenceInput> component generates a GET_LIST request, with the params set to {filter: {q: ""}}, aka an empty filter for the column q.
This is a strange behaviour, because backends may actually try to interpret this filter, even though it has no value. For example, flask-rest-jsonapi tries to filter by a column called q, which doesn't exist. Similarly, discussion in #2615 shows this problem in a different backend.
Describe the solution you'd like
By default, a <ReferenceInput> should not add any parameters to the GET_LIST request. Instead, users should be required to implement a filterToQuery function, where they can add their own filter if needed.
In terms of the actual code, I think the only thing we'd need to do is change the default prop value of filterToQuery to a no-op:
Is your feature request related to a problem? Please describe.
By default, a
<ReferenceInput>
component generates aGET_LIST
request, with the params set to{filter: {q: ""}}
, aka an empty filter for the columnq
.This is a strange behaviour, because backends may actually try to interpret this filter, even though it has no value. For example,
flask-rest-jsonapi
tries to filter by a column calledq
, which doesn't exist. Similarly, discussion in #2615 shows this problem in a different backend.Describe the solution you'd like
By default, a
<ReferenceInput>
should not add any parameters to theGET_LIST
request. Instead, users should be required to implement afilterToQuery
function, where they can add their own filter if needed.In terms of the actual code, I think the only thing we'd need to do is change the default prop value of
filterToQuery
to a no-op:react-admin/packages/ra-ui-materialui/src/input/ReferenceInput.tsx
Line 162 in 0b08e99
Describe alternatives you've considered
Currently this default behaviour can be disabled by adding a no-op
filterToQuery
, e.g.:I'd be happy to write a PR if this would be acceptable.
The text was updated successfully, but these errors were encountered: