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 <WithRecord> render prop type #8993

Merged
merged 3 commits into from
Jun 9, 2023
Merged

Conversation

slax57
Copy link
Contributor

@slax57 slax57 commented Jun 9, 2023

Problem

#8963 introduced a change to <WithRecord>, which allowed the render prop return a ReactNode instead of a ReactElement.
But since <WithRecord> currently returns the result of the render function without wrapping it in JSX first, we get the following TS error:

image

Solution

Wrap the result of the render function in a React Fragment.
Also, I removed the the RenderRecordFunction type because to me FunctionField and WithRecord do not share the same render function signature.

@slax57 slax57 added the RFR Ready For Review label Jun 9, 2023
@slax57
Copy link
Contributor Author

slax57 commented Jun 9, 2023

As @fzaninotto pointed out, WithRecord should actually support ReactNode. So I changed the component to allow for this useage.
I also edited the PR description accordingly.

@fzaninotto fzaninotto merged commit cad1f6a into master Jun 9, 2023
8 checks passed
@fzaninotto fzaninotto deleted the WithRecordProps-render-prop branch June 9, 2023 14:08
@fzaninotto fzaninotto added this to the 4.11.2 milestone Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants