-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Update creating-dynamic-blocks.md #10786
Conversation
While posts are loading inside the edit method the `posts` variable is null, attempting to access `post[0]` causes an error "TypeError: Cannot read property '0' of null" and the block displays "This block has encountered an error and cannot be previewed." checking that posts has a value resolves this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the docs contributions! 📖 💟
if ( ! props.posts ) { | ||
return "Loading..."; | ||
} | ||
if ( props.posts.length === 0 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recognise that it doesn't really matter much but could we have a newline before this if
block and after this if
block? It makes it slightly easier to read.
Going to approve it though because it's a small thing and otherwise looks great to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @chrisvanpatten I've added the spacing to both this if
and the one in your other comment 😃
Just for a sanity check I want @ajitbohra to take a look too ^__^ |
@mrmadhat thank you 👍 |
* Update creating-dynamic-blocks.md While posts are loading inside the edit method the `posts` variable is null, attempting to access `post[0]` causes an error "TypeError: Cannot read property '0' of null" and the block displays "This block has encountered an error and cannot be previewed." checking that posts has a value resolves this. * Added spacing to improve readability
Description
While posts are loading inside the edit method the
posts
variable is null, attempting to accesspost[0]
causes an error"TypeError: Cannot read property '0' of null" and the block displays "This block has encountered an error and cannot be previewed."
checking that posts has a value resolves this.
How has this been tested?
I have tested these changes in browser.
Types of changes
Bug fix in creating your first block docs