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

cannot pass meta via ReferenceInput/useReferenceInputController #8191

Closed
stesie opened this issue Sep 23, 2022 · 2 comments
Closed

cannot pass meta via ReferenceInput/useReferenceInputController #8191

stesie opened this issue Sep 23, 2022 · 2 comments

Comments

@stesie
Copy link
Contributor

stesie commented Sep 23, 2022

What you were expecting:

Receiving meta in data provider when using ReferenceInput and passing in queryOptions.

What happened instead:

meta is undefined.

ReferenceInput passes all props towards useReferenceInputController.
Then useReferenceInputController destructures its props, among others into queryOptions.

Those queryOptions are then all passed to useGetList in https://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/controller/input/useReferenceInputController.ts#L101
... however meta would have to go to the second parameter object. Not the third.

Contrary useListController is separating those here https://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/controller/list/useListController.ts#L48 (and passing separately in turn)

Steps to reproduce:

Related code:

                    <ReferenceInput source="pricelistId" reference="pricelists" queryOptions={{ meta }}>
                        <SelectInput fullWidth optionText="name" disabled />
                    </ReferenceInput>

Other information:

Environment

  • React-admin version: 4.2.7
  • Last version that did not exhibit the issue (if applicable):
  • React version: 18.2.0
  • Browser: Chrome 105
  • Stack trace (in case of a JS error):
@WiXSL
Copy link
Contributor

WiXSL commented Sep 23, 2022

Thanks for the report!
Indeed, ReferenceInput has yet to have this feature.

@fzaninotto
Copy link
Member

fzaninotto commented Sep 23, 2022

Fixed by #8192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants