---
url: https://lit-ui-router.dev/api/ui-router-server/ssr-client/functions/seed.md
---
[ui-router-server](../../index.md) / [ssr-client](../index.md) / seed

# Function: seed()

```ts
function seed(router, payload): () => void;
```

Defined in: [ssr-client.ts:47](https://github.com/simshanith/lit-ui-router/blob/1cd954559604dabdcb4d0a419ac42b07b38f0fba/packages/ui-router-server/src/ssr-client.ts#L47)

Seeds `router` with a resolve payload, so the transition it was drawn for
adopts the payload's values in place of running their resolve functions.

Call it before the router starts. The boot transition is still a real
transition, with every hook it would fire; only the resolves change. When
its target state and url parameters are the ones the payload was drawn
for, each entering state's resolves in the payload are pre-resolved with
the payload's values. Every other resolve runs its function as it would
without a payload: a resolve the payload does not carry, a `NOWAIT`
resolve, every resolve of a transition drawn for another state or other
parameters, and every resolve when `payload` is `undefined`. A transition
that redirects is checked against the payload again as its successor.

The seed disarms itself once a transition succeeds.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `router` | [`UIRouter`](https://ui-router.github.io/core/docs/latest/classes/_router_.uirouter.html) | the client router, its states registered |
| `payload` | [`ResolvePayload`](../../ssr/interfaces/ResolvePayload.md) | `undefined` | the payload `dehydrate` drew, as parsed from the document, or `undefined` when there is none |

## Returns

a function that disarms the seed

() => `void`

## Throws

a `TypeError`, before any hook is registered, when `payload.resolves` or a state's entry in it is `null` or missing

## Example

```ts
import { seed } from 'ui-router-server/ssr/client';

seed(router, payload);
router.start();
```
