fix: Use optional chain when access to block map entity #123
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Use optional chain to access to the entity of BlockMap in
groupBlockContent
method.Why
First of all, thank you for your library. I'm a beginner with react-notion. When I try to render a Notion page with the ID 2e22de6b770e4166be301490f6ffd420, which is shown as a sample page in notion-api-worker, then met error as below.
https://github.com/splitbee/notion-api-worker?tab=readme-ov-file#load-page-data
I investigated why it occurs and noticed there is the block that has no
value
property like{ "role": "none" }
. You can see it in below section.curl results of https://notion-api.splitbee.io/v1/page/2e22de6b770e4166be301490f6ffd420
So I want to ignore it when render them.
How
I met error when access to
value
property in block map because{ "role": "none" }
doesn't have it. So ignore it by adding optional chaining.