(result: ArtifactSmokeRenderResult)
| 247 | * is not obvious from `Cannot read properties of undefined` alone. |
| 248 | */ |
| 249 | export const smokeRenderRejection = (result: ArtifactSmokeRenderResult): string | null => { |
| 250 | if (result.status === "ok") return null; |
| 251 | return [ |
| 252 | `This component threw on its first render, so the artifact would show an error instead of a UI: ${result.message}`, |
| 253 | result.componentStack ? `\n${trimmedComponentStack(result.componentStack)}\n` : "", |
| 254 | "The render happened with every query still pending and no data returned — exactly the state the user sees first — so guard the loading state (`if (query.isLoading) return <ArtifactLoading />`) and read possibly-absent data with `?.`.", |
| 255 | "Fix the component and call create-artifact again.", |
| 256 | ] |
| 257 | .filter((part) => part.length > 0) |
| 258 | .join(" "); |
| 259 | }; |
| 260 | |
| 261 | // --------------------------------------------------------------------------- |
| 262 | // Provider pairing |
no test coverage detected