S
SolidJS15mo ago
Fabian

ErrorBoundary requires string fallback when root is not a fragment

Hi, I'm running into an issue with ErrorBoundary and wanted to make sure that this is not a user error before filing a bug. When the top-level element is not a fragment, the ErrorBoundary chokes on any fallback value that's not a string: https://playground.solidjs.com/anonymous/799b7473-b4e8-40ab-840d-c6a19f922241
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
7 Replies
foolswisdom
foolswisdom15mo ago
I'm not sure what you're referring to about fragments here, but the issue seems to be that the DOM renderer refuses to render error objects. That seems expected to me. The type signature of fallback also indicates that it expects a valid JSX value to be returned
Fabian
FabianOP15mo ago
@foolswisdom I'm referring to the outermost element. See this example for comparison: https://playground.solidjs.com/anonymous/2d7e50e9-05f0-4a51-8a3e-c0d40b5940cc
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Fabian
FabianOP15mo ago
The example is adapted from the official tutorial: https://www.solidjs.com/tutorial/flow_error_boundary?solved
SolidJS
Solid is a purely reactive library. It was designed from the ground up with a reactive core. It's influenced by reactive principles developed by previous libraries.
Fabian
FabianOP15mo ago
Coming back to my original question: Is the problem here that the tutorial should not return the error object, or that the behavior changes when the component returns an element instead of a fragment?
foolswisdom
foolswisdom15mo ago
I think it's worth a bug report In a sense it's unsupported usage and the tutorial should be updated, but on the other hand I think the expectation is that the framework converts anything it doesn't recognize to a string, rather than skipping it, or if it skips, it should skip consistently.
Fabian
FabianOP15mo ago
Got it, I'll file two bugs then
foolswisdom
foolswisdom15mo ago
I think the maintainers will see it as a bug that it doesn't get converted to a string
Want results from more Discord servers?
Add your server