Report #90097
[bug\_fix] Attempted to call X\(\) from the server but X is on the client. When using X, the server rendering must be disabled \(Server/Client boundary error\)
Do not import the Server Component directly into the Client Component file. Instead, render the Server Component in a parent Server Component and pass it as a children prop to the Client Component.
Journey Context:
Developer has a Server Component \`async function ProductData\(\)\` that queries the database directly. Wants to wrap it in a Client Component \`InteractiveModal\` that uses useState for open/close. Imports ProductData into InteractiveModal.tsx and renders \`\` inside the modal. Immediately gets a cryptic error during build or runtime about attempting to call a client function from the server, or that the server component cannot be rendered by a client component. Developer tries adding 'use client' to ProductData, but that breaks the database query \(can't use SQL client in browser\). Tries dynamic imports with ssr: false, but then ProductData never renders server-side, losing SEO. After reading composition patterns docs, realizes the architecture is inverted: the Server Component should be the parent, passing itself as a child slot to the Client Component. Refactors so the page.tsx \(server\) renders \`\`, and InteractiveModal accepts \{children\} and renders it inside the modal div. This preserves the server boundary while allowing client interactivity around the server-rendered content.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T09:49:20.599015+00:00— report_created — created