react-live icon indicating copy to clipboard operation
react-live copied to clipboard

ErrorBoundary(...): Nothing was returned from render

Open paul-pro opened this issue 4 years ago • 3 comments

Hi! Looks like when you use undefined JS object or its method, error will be normally caught: e.g. code= {'some.method'} will correctly render error with ReferenceError: some is not defined

But when you try to reference some undefined method of real object it will cause internal error which will break whole page. See reproduction on code sandbox: https://codesandbox.io/s/react-live-bug-mqbu7 (btw, code={'window'} will also blow up page)

I found this bug while live editing input code in mdx environment.

paul-pro avatar Feb 23 '20 18:02 paul-pro

Facing same issue, any updates on this?

sanket03 avatar Apr 05 '20 20:04 sanket03

The error boundary class needs:

static getDerivedStateFromError(error) {
    return { hasError: true };
}

I still had a very rough time, but that's one of the issues around evalCode.

Downchuck avatar Aug 02 '21 19:08 Downchuck

@jpdriver please include a fix for this issue in v3.

lex111 avatar Sep 12 '21 14:09 lex111