Prevent throwing in react and solid component checks #11624
Merged
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.
Changes
fix #11615
Svelte 5 is a function component, so it messes some of our existing renderers like React and Solid where their
check()
functions assumes JSX and wouldn't throw, but Svelte 5 trips them up because it's not JSX functions.Anyways, I think it's more correct that these check functions do not throw since they only do checking, like how Preact works now.
Testing
No tests as we don't have them for Svelte 5, and it's a little tricky to emulate a component that would error 😬 Hopefully the current passing tests are enough though
EDIT: I have to tweak one test regarding runtime errors from Preact components, because previously it relied on the React renderer's check to throw the error if it failed to render, which I don't think is necessarily correct. For now, renderers with
check()
that simply runs the render will not be able to detect actual runtime errors to display on the error overlay.Docs
n/a. bug fix.