# Handle an element type your client does not know

This page shows what a client does when a screen carries an element whose
`"type"` it does not draw. It uses the branch-library onboarding: a screen
that asks a new branch's staff to choose the branch on a map, with an
element of a type the host added, `branch_map`.

It assumes the package's fields are in your schema, as in [Add Journeys to
the schema you already have](add-journeys-to-your-schema.md).

## Why elements arrive as JSON

A `JourneyScreen`'s `elements` is one `RiddlerJSON` value: the list of
elements the visitor is shown, in document order, as riddler presents them.
It is not a GraphQL type per element because riddler's element types grow
from release to release and a host may present types of its own; neither
needs a change to this package or to the schema a client generated from.
So a client can always be handed an element whose type it has never seen:

```json
{
  "screen": {"key": "choose_branch", "title": "Your branch"},
  "elements": [
    {"type": "heading", "key": "where", "level": 2, "text": "Where is the new branch?"},
    {"type": "branch_map", "key": "branch_location"},
    {"type": "button", "key": "continue", "outcome": "branch_chosen", "label": "Continue"}
  ],
  "moves": {"outcomes": ["branch_chosen"], "back": true}
}
```

A client written against riddler's element types draws the `heading` and the
`button`, and has nothing to draw for `branch_map`.

## Do not draw it, and do not submit the screen

Riddler's presented-answer schema states the fallback: a client that does
not know an element's type does not render that element and does not let
the visitor submit that screen from it. So the client:

1. reads each element's `"type"` and draws the ones it knows;
2. draws nothing in place of an element of any other type, and does not
   guess at one from its other keys;
3. does not let the visitor submit the screen: it does not send
   `submitJourney` for it, and shows every button that would send one as
   unavailable.

A visitor moved on from a screen they saw only part of has answered
something they did not see, which is why the screen is not submitted. What
the client shows in place of the missing part, such as a line saying that
part of the screen cannot be shown here, is the client's to decide.

## Draw a type of your own

A host that presents a type of its own, and wants a client to draw it, ships
a client that knows the type. The package's schema needs no change for it,
because the type crosses inside `elements`; what the element carries, and
what the host accepts back for it, are the host's.
