In a server-driven mobile app, what should a two-year-old build do when a layout contains a component type it has never seen, and how does a versioned layout schema help?
answer
- prevent first, defend anyway
- the build declares its schema version
- optional skips, required falls back
- a fallback node or the bundled screen
- a breaking prop change means a new type
basics
~20 sNever crash: skip an unknown optional component, draw a server-supplied fallback where one exists, and show the last-good or bundled screen when a required one has neither. A versioned schema lets the server avoid sending such components at all.
solid answer
~50 sPrevention comes first: each layout request carries the build's **layout schema version**, and the server composes the layout from the component types that version supports, so a build rarely meets a type it lacks. The client still defends itself, because servers have bugs and composition rules miss versions. Each node is **optional**, so an unknown one is skipped and its slot collapses; or it carries a **fallback** node of a basic type every supported build knows; or it is **required** with no fallback, and then an unknown type invalidates the whole layout, so the app shows its last-good cached layout or the bundled screen. An unknown action gets the same treatment: disable or hide that tap rather than guess. Every fallback is logged with the layout id and the type, so the team sees which builds are being degraded and by what.
code
json · 15 lines{
"schemaVersion": 7,
"layoutId": "home-2026-w41-r3",
"root": {
"type": "vertical_stack",
"children": [
{ "type": "hero_banner", "required": true,
"props": { "title": "Weekly deals" } },
{ "type": "recipe_swipe_deck", "required": false,
"fallback": { "type": "product_carousel",
"props": { "title": "This week's recipes", "source": "recipes_w41" } } },
{ "type": "loyalty_meter", "required": false }
]
}
}go deeper
Remember that an old build must never crash on a layout: unknown parts are skipped, replaced by a fallback, or the whole screen falls back to a saved or bundled one.
Explain how the build's schema version lets the server assemble layouts from known types only, and how optional, fallback and required nodes behave on the client.
Show both defence lines, decide what is required per screen, handle breaking prop changes with new types, and make every fallback visible in logs.
Set the schema evolution rules for every team that adds components, and tie composition support for old schema versions to the app's wider support window.
## Why an old build will meet an unknown component An installed app cannot be recalled. A build released two years ago may still open the grocery app every week, and its **component registry**, the lookup from component type to renderer, was frozen the day it was compiled. Meanwhile the server-driven home screen keeps gaining components: a recipe deck, a loyalty meter, a delivery-slot picker. Sooner or later an old build receives a node whose `type` it has never heard of, because: - the layout service composes for the newest builds and forgets an older one; - a segment or test-arm rule adds a newer component to one audience without checking which builds are in it; - a merchandiser publishes a layout without the tooling checking every supported version; - a component's shape changed and the old build no longer recognises it. The design must make all of these survivable, which means two lines of defence. ## Line one: tailor the layout to the build's schema version A **versioned layout schema** gives every set of components and their props a number. The build sends the version it understands, and the server uses it: - The layout service keeps a table of which component types and which props each schema version supports. - It assembles each response from that subset only, substituting or omitting anything newer. - Within a schema version, changes are **additive**: new optional props, never a renamed or removed one. - A breaking change to one component, such as a renamed required prop, ships as a **new type name**, for example `promo_banner_v2`, that new builds register, while older builds keep receiving the old shape. - If layouts pass through a shared HTTP cache, the response must name the version header in `Vary`, or the version must be part of the URL, so a cache never hands one version's layout to another. How long the server keeps composing for an old version is the app's general support-window policy for old builds; the layout service follows it rather than inventing its own. ## Line two: the client's fallback ladder Prevention fails sometimes, so the client never trusts it fully. Applied per node, in order: 1. **Unknown props on a known component** are ignored; missing required props make that node invalid. 2. **An unknown optional component** is skipped and its slot collapses. 3. **An unknown component with a `fallback`** renders the fallback node instead, typically a simpler component every supported build knows. 4. **An unknown required component with no fallback** invalidates the whole layout: show the last-good cached layout, or the bundled default if none is usable. 5. **An unknown action type** disables or hides that tap rather than performing a guessed action. ## Choosing between the fallbacks | Fallback | Fits when | Cost | |---|---|---| | Skip and collapse | Decorative or promotional sections | The user silently loses that content | | Generic placeholder | Keeping layout stable matters more than content | An empty box can look broken | | Server-supplied fallback node | A simpler version still serves the purpose | Larger payload; the fallback must be maintained | | Whole-screen fallback | The screen is meaningless without the component | The user sees older or default content | **Required** is a judgement about meaning: a weekly-deals banner is optional on the home screen, while an order-summary block on a checkout upsell screen is not. The server sets the flag per node, so the same component can be optional on one screen and required on another, and the rule for which is which belongs in the layout tooling, not in each merchandiser's head. ## Making degradation visible A silent fallback is a hidden outage. The client logs every fallback with the layout id, the unknown type, the schema version and the build version. Grouped on a dashboard, that shows which builds are being degraded, which layouts cause it, and whether a server-side composition rule is missing. It also feeds the decision to stop composing for an old schema version. ## What belongs elsewhere How the wider API treats unknown fields and enum values on old builds, how a build advertises capabilities in general, and when a minimum supported version is enforced are the app-versioning policy's subjects. This design keeps the layout schema's own versions and what a build does with a component it cannot draw.
- The build's schema version travels in a request header and layouts pass through a shared HTTP cache; what can go wrong?The cache can hand a layout composed for a newer schema to an older build, because it matched the request on the URL alone. The response must list that header in `Vary`, so a cache reuses a stored response only when the presented header matches the original request; putting the schema version in the URL achieves the same.
- A component's required prop is renamed; do you bump the whole schema version or add a new component type?Treat it as breaking for that component: old builds would look for the old name and find nothing. The usual choice is a new type name, or a new version of that one component, that new builds register, while the server keeps sending the old shape to builds that only know it. A schema-wide bump is kept for changes to the envelope or the node structure itself.
- An unknown component should throw so the team notices it in crash reports.
- Skipping an unknown component is always safe, whatever that component was for.
- Every build can get the newest layout because old builds ignore what they do not know.
- Renaming a component's prop in place is safe because layouts are only data.
- Bumping the layout schema version makes old builds learn the new components.