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: content fix #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix: content fix #60

wants to merge 1 commit into from

Conversation

honorsuper
Copy link

What does it do?

If the content in the props is empty, an exception will occur.

Why is it needed?

Before the data is returned, if content is empty, an exception will occur.
image

@oiorain
Copy link

oiorain commented Dec 17, 2024

Hi there!
Thank you for your contribution!
Could you give a little more context on what fix you're bringing and what your contribution is?

Thank you

@honorsuper
Copy link
Author

honorsuper commented Dec 17, 2024

Hi there! Thank you for your contribution! Could you give a little more context on what fix you're bringing and what your contribution is?

Thank you

In the file BlocksRenderer.tsx,
image
The value of the content property is fetched from an API. If the data is not returned, it will be undefined. In this case, calling props.content.map will throw an exception,「Cannot read properties of undefined (reading 'map')」,So, what I have done is adding the Optional Chaining Operator to solve this issue
@oiorain

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

Successfully merging this pull request may close these issues.

2 participants