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

Function smokeRenderRejection

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

Source from the content-addressed store, hash-verified

247 * is not obvious from `Cannot read properties of undefined` alone.
248 */
249export 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

Callers 1

createArtifactFunction · 0.90

Calls 1

trimmedComponentStackFunction · 0.85

Tested by

no test coverage detected