Problem
Two SSR gaps in renderComponentWithSlot (packages/stx/src/utils.ts) surfaced while building a real multi-page storefront:
Nested-view component resolution — the resolver searched the calling file's
<dir>/components, the globalcomponentsDir(framework defaults), andsrc/components/componentsfallbacks, but never the canonical projectresources/views/components. Project components resolved for root-level views (e.g.resources/views/index.stx) yet 404'd for any view in a subdirectory (e.g.resources/views/products/index.stx,checkout/*,policies/*).definePropsdefaults during SSR — a component's<script>is evaluated client-side only, so destructuring defaults likeconst { steps = [...] } = defineProps()wereundefinedat server-render time. Any@foreach//:proprelying on a default (a prop the caller omitted) broke — including the shippedStorefront/CheckoutSteps(@foreach (steps ...)→ "steps is not iterable"), plus custom header/footer nav defaults.
Fix
Add
resources/views/components(and the legacyresources/components) to the project-wide fallback search dirs, so project components resolve from any view depth — matching how framework defaults already resolve globally.Add a best-effort
applyDestructuredPropDefaults()pass that parses a component'sdefinePropsdestructuring defaults and fills only the keys the caller didn't provide (caller-provided props always win). Wrapped in try/catch — any parse/eval failure leaves the context exactly as before.
Both changes are additive and backwards-compatible.
🤖 Generated with Claude Code