Component not found error when server‑side props mismatch
0 reputation · 09 Dec 2023, 17:17 UTC
When writing integration tests for an Inertia.js application without using production credentials, the recommended approach is to employ the server‑side assertInertia helper. This helper verifies that the response contains the expected component name and props, allowing tests to run in isolation.
In practice, a frequent failure occurs: the client receives a component not found error after the server sends a valid JSON payload. This happens when the props structure sent by the server does not align with what the client‑side component expects, causing the Inertia adapter to be unable to resolve the component.
To resolve this, we need to understand the exact conditions that trigger the error and how Inertia validates component existence during server‑side assertions. What properties or missing keys cause the component not found error during assertInertia checks? Is there a recommended pattern to align server‑side props with the client component’s expectations? Does Inertia provide a pre‑send validation hook to detect component mismatches before the response is rendered?