Skip to content

fix: handle nonexistent field: value#125

Merged
tobiaslins merged 1 commit intosplitbee:masterfrom
khaaleoo:fix-#124-func-groupBlockContent-undefined-content
Oct 28, 2024
Merged

fix: handle nonexistent field: value#125
tobiaslins merged 1 commit intosplitbee:masterfrom
khaaleoo:fix-#124-func-groupBlockContent-undefined-content

Conversation

@khaaleoo
Copy link
Copy Markdown
Contributor

This error occurs because there are non-existent value fields in the response.

Screenshot 2024-10-28 at 14 14 31

@ilhamwahabi
Copy link
Copy Markdown

May I know when this fix will be released? I'm also got this issue and make my website crashed, so definitely need this.

Thanks for your help.

@dimitrisraptis96
Copy link
Copy Markdown

I've fixed it by removing attributes with role: "none" from the response before passing it to the blockMap prop of the NotionRenderer. I used this simple function:

function removeNoneRoles(blocks) {
    return Object.fromEntries(
        Object.entries(blocks).filter(([_, value]) => value.role !== 'none')
    );
}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants