FormidableLabs / react-live

A flexible playground for live editing React components
https://commerce.nearform.com/open-source/react-live/
MIT License
4.29k stars 240 forks source link

fix: wrap preview in boundary #392

Open r281GQ opened 2 months ago

r281GQ commented 2 months ago

Description

React-Live did not catch a runtime error (not caught in the transpile phase).

We can't catch all errors (like event handlers) but we can catch useEffect's cleanup functions.

Fixes # (issue)

https://github.com/user-attachments/assets/7fa18a71-e688-406b-aa98-9f526518fa43

The above video demonstrates, not a cleanup function not causing crash.

Worth noting, cleanup function runs one cycle "behind", therefore even if we correct the code the previous code with error still shows up.

Type of Change

How Has This Been Tested?

Checklist: (Feel free to delete this section upon completion)

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-live-docs-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 19, 2024 10:31am
changeset-bot[bot] commented 2 months ago

⚠️ No Changeset found

Latest commit: a0d276e6b3eb29a0ff3ceac90c0f6d4b40c91300

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR