[API reference](https://evolu.dev/docs/api-reference) › [@evolu/svelte](https://evolu.dev/docs/api-reference/svelte) › ownerSyncStatusState

## Call Signature

```ts
function ownerSyncStatusState<
  S extends Readonly<
    Record<string, Readonly<Record<string, AnyStandardSchemaV1>>>
  >,
>(
  evolu: AppOwnerEvolu<S>,
  syncState: ReadonlyStore<SyncState | null>,
): {
  status: OwnerSyncStatus;
};
```

Defined in: [index.svelte.ts:453](https://github.com/evoluhq/evolu/blob/aa223771feea747ffb1b0f5f3271574455633e37/packages/svelte/src/lib/index.svelte.ts#L453)

Follows the [OwnerSyncStatus](https://evolu.dev/docs/api-reference/common/local-first/Shared/type-aliases/OwnerSyncStatus) of an owner in the database of `evolu`,
read from `syncState`, the [SyncStateDep.syncState](https://evolu.dev/docs/api-reference/common/local-first/Evolu/interfaces/SyncStateDep#syncstate) store of the deps
the instance was created with, such as [evoluSvelteDeps](https://evolu.dev/docs/api-reference/svelte/variables/evoluSvelteDeps), and returns an
object whose `status` updates when the status changes, not with every
snapshot. Without `observedOwner`, it is the status of [Evolu.appOwner](https://evolu.dev/docs/api-reference/common/local-first/Evolu/interfaces/Evolu#appowner).
Otherwise `observedOwner` returns the owner [ownerSync](https://evolu.dev/docs/api-reference/svelte/functions/ownerSync) takes; a null
owner, for a component that waits for one, gives `NoRelays`. Before the first
snapshot, during server rendering, and until its effect runs, the status is
`NoRelays`. A status keeps its object while it is unchanged. See
[OwnerSyncStatus](https://evolu.dev/docs/api-reference/common/local-first/Shared/type-aliases/OwnerSyncStatus) for what to show.

It creates an `$effect`, so call it where Svelte allows one, such as during
component initialization or inside `$effect.root`. It stops following the
store when that component or root is destroyed.

### Example

Runes such as `$state` work only in Svelte components and `.svelte.ts` or
`.svelte.js` modules. A component calls `syncLabelState` during its
initialization.

```ts
import {
  assertType,
  type AppOwnerEvolu,
  type OwnerSyncStatus,
  type ReadonlyStore,
  type SyncState,
  type TestEvoluSchema,
} from "@evolu/common";
import { ownerSyncStatusState } from "@evolu/svelte";

const syncLabelState = (
  evolu: AppOwnerEvolu<TestEvoluSchema>,
  syncState: ReadonlyStore<SyncState | null>,
) => {
  const sync = ownerSyncStatusState(evolu, syncState);
  const label = $derived(sync.status.type);
  return { label: () => label };
};

assertType<
  ReturnType<ReturnType<typeof syncLabelState>["label"]>,
  OwnerSyncStatus["type"]
>();
```

## Call Signature

```ts
function ownerSyncStatusState<
  S extends Readonly<
    Record<string, Readonly<Record<string, AnyStandardSchemaV1>>>
  >,
>(
  evolu: DeviceEvolu<S>,
  syncState: ReadonlyStore<SyncState | null>,
  observedOwner: () => ReadonlyOwner | Owner | null,
): {
  status: OwnerSyncStatus;
};
```

Defined in: [index.svelte.ts:458](https://github.com/evoluhq/evolu/blob/aa223771feea747ffb1b0f5f3271574455633e37/packages/svelte/src/lib/index.svelte.ts#L458)

For the owner `ownerSync` takes, or null while there is none.