MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / smokeRenderRejection

Function smokeRenderRejection

packages/hosts/mcp/src/create-artifact.ts:331–341  ·  view source on GitHub ↗
(result: ArtifactSmokeRenderResult)

Source from the content-addressed store, hash-verified

329 * is not obvious from `Cannot read properties of undefined` alone.
330 */
331export 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

Callers 1

validateRenderAndSaveFunction · 0.90

Calls 1

trimmedComponentStackFunction · 0.85

Tested by

no test coverage detected