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

Fix Fields doc reference to getMany() usage in v3.x #7773

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

mfaywu
Copy link

@mfaywu mfaywu commented Jun 1, 2022

There's a statement at the end of the section on ReferenceFields [0] which says that ReferenceField will use /users?ids=[] to fetch source data:

Then react-admin renders the with a loader for the , fetches the API for the related users in one call (GET http://path.to.my.api/users?ids=[789,735]), and re-renders the list once the data arrives. This accelerates the rendering and minimizes network load.

However, the beginning of the section on ReferenceFields [1] says ReferenceField will use dataProvider.getMany() to fetch source data:

This component fetches a referenced record (using the dataProvider.getMany() method), and passes it to its child.

The DataProvider page [2] shows that .getMany() is

GET http://my.api.url/posts?filter={"id":[123,456,789]}

So I think the statement at the end of the section on ReferenceFields [0] should be updated!

I'll open PRs for 1.x and 2.x as well since those look wrong too.

[0] https://marmelab.com/react-admin/doc/3.12/Fields.html#usage-9
[1] https://marmelab.com/react-admin/doc/3.12/Fields.html#referencefield
[2] https://marmelab.com/react-admin/doc/3.12/DataProviders.html#usage

@vercel vercel bot temporarily deployed to Preview – react-admin June 1, 2022 21:26 Inactive
@mfaywu mfaywu changed the title Fix Fields doc reference to getMany() usage Fix Fields doc reference to getMany() usage in v3.x Jun 1, 2022
@fzaninotto fzaninotto merged commit 355ecaa into marmelab:3.x Jun 2, 2022
@fzaninotto
Copy link
Member

Well spotted, thanks!

@fzaninotto fzaninotto added this to the 3.19.12 milestone Jun 2, 2022
@mfaywu mfaywu deleted the fay/fix-3.x-fields-doc branch June 21, 2022 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants