hygraph/rich-text

Error in elementIsEmpty

nrandell opened this issue · 1 comments

I've got an issue where an empty heading throws an exception.

[@GraphCMS]/rich-text-react-renderer/dist/rich-text-react-renderer.esm.js:382:5
WebpackError: TypeError: Cannot read properties of undefined (reading 'text')

Here's an excerpt from the json

{"type": "heading-two",
    {
        {
            "children": [
                {
                    "children": [
                        "text": ""
                    ]
                }
            ]
        }
    }
}

I think we need to check that children[0].text actually exists

Hey, thanks for reporting it.

I tried to reproduce the error but wasn't able to do so.

Would you mind sharing a valid JSON? The one you added to the issue isn't valid and doesn't look like an AST.

Thanks ❤️