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

ServerSideRender: Update documentation for placeholder props #33030

Merged
merged 1 commit into from
Jun 29, 2021

Conversation

Mamaduka
Copy link
Member

Description

Updates documentation for EmptyResponsePlaceholder, ErrorResponsePlaceholder and LoadingResponsePlaceholder. Also adds basic usage example.

Similar to #29925

It's best to pass a component to renderAppender, as is done in most core blocks. Passing a callback function will cause React to treat this as a new function component on every render causing reconciliation issues.

Types of changes

Documentation

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thank you for fixing this documentation issue!

@@ -67,25 +67,35 @@ E.g: `{ post_id: 12 }`.

### EmptyResponsePlaceholder

This is a [render prop](https://reactjs.org/docs/render-props.html). When the api response is empty, the value of this prop is rendered. The render prop will receive the value of the api response as well as all props passed into `ServerSideRenderer`.
The component is rendered when the API response is empty. The component will receive the value of the API response, and all props passed into `ServerSideRenderer`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that the props are in fact components and not render props. It is unfortunate that our documentation was wrong all this time.

@Mamaduka
Copy link
Member Author

Thanks for the review, @jorgefilipecosta.

@Mamaduka Mamaduka merged commit 07406cd into trunk Jun 29, 2021
@Mamaduka Mamaduka deleted the update/server-side-renderer-docs branch June 29, 2021 18:50
@github-actions github-actions bot added this to the Gutenberg 11.0 milestone Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Server Side Render /packages/server-side-render [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants