(result: ArtifactSmokeRenderResult)
| 329 | * is not obvious from `Cannot read properties of undefined` alone. |
| 330 | */ |
| 331 | export const smokeRenderRejection = (result: ArtifactSmokeRenderResult): string | null => { |
| 332 | if (result.status === "ok") return null; |
| 333 | return [ |
| 334 | `This component threw on its first render, so the artifact would show an error instead of a UI: ${result.message}`, |
| 335 | result.componentStack ? `\n${trimmedComponentStack(result.componentStack)}\n` : "", |
| 336 | "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 `?.`.", |
| 337 | "Fix the component and call create-artifact again.", |
| 338 | ] |
| 339 | .filter((part) => part.length > 0) |
| 340 | .join(" "); |
| 341 | }; |
| 342 | |
| 343 | // --------------------------------------------------------------------------- |
| 344 | // Provider pairing |
no test coverage detected