[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [local‑first/Evolu](https://evolu.dev/docs/api-reference/common/local-first/Evolu) › SyncStateDep

Defined in: [packages/common/src/local-first/Evolu.ts:1126](https://github.com/evoluhq/evolu/blob/f082fdd974e25fa0eb1134e4b34f15b740af8fe2/packages/common/src/local-first/Evolu.ts#L1126)

Dependency wrapper for the shared [SyncState](https://evolu.dev/docs/api-reference/common/local-first/Shared/interfaces/SyncState) store.

## Properties

<a id="syncstate"></a>

### syncState

```ts
readonly syncState: ReadonlyStore<
  | SyncState
| null>;
```

Defined in: [packages/common/src/local-first/Evolu.ts:1182](https://github.com/evoluhq/evolu/blob/f082fdd974e25fa0eb1134e4b34f15b740af8fe2/packages/common/src/local-first/Evolu.ts#L1182)

[ReadonlyStore](https://evolu.dev/docs/api-reference/common/Store/interfaces/ReadonlyStore) of the latest [SyncState](https://evolu.dev/docs/api-reference/common/local-first/Shared/interfaces/SyncState) shared by all
[Evolu](https://evolu.dev/docs/api-reference/common/local-first/Evolu/interfaces/Evolu) instances, or null before the shared worker sends its first
snapshot. It lists every database the shared worker serves, including other
tabs', so an app finds its own by [Evolu.name](https://evolu.dev/docs/api-reference/common/local-first/Evolu/interfaces/Evolu#name). Apps show users an
owner's [OwnerSyncStatus](https://evolu.dev/docs/api-reference/common/local-first/Shared/type-aliases/OwnerSyncStatus), from [syncStateToOwnerSyncStatus](https://evolu.dev/docs/api-reference/common/local-first/Shared/functions/syncStateToOwnerSyncStatus) or a
framework binding's `useOwnerSyncStatus`; views of each relay use
[syncStateToRelaySyncStates](https://evolu.dev/docs/api-reference/common/local-first/Shared/functions/syncStateToRelaySyncStates).

Each snapshot keeps the previous snapshot's object for every part that did
not change, and a snapshot equal to the previous one leaves the store
unchanged, so parts and derived statuses can be compared with `===`.

### Example

```ts
import {
  assertEqual,
  createId,
  createStore,
  Millis,
  testCreateDeps,
} from "@evolu/common";

const openRelayLabels = (deps: SyncStateDep): ReadonlyArray<string> =>
  (deps.syncState.get()?.transports ?? [])
    .filter(({ connection }) => connection.type === "Open")
    .map(({ label }) => label);

using syncState = createStore<SyncState | null>(null);
assertEqual(openRelayLabels({ syncState }), []);

const deps = testCreateDeps();
syncState.set({
  transports: [
    {
      type: "WebSocket",
      id: createId<"SyncTransport">(deps),
      label: "wss://relay.example",
      connection: {
        type: "Open",
        openedAt: Millis.orThrow(1000),
        error: null,
      },
    },
  ],
  tenants: [],
});
assertEqual(openRelayLabels({ syncState }), ["wss://relay.example"]);
```