[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) › subscribeAppOwnerState

```ts
function subscribeAppOwnerState<
  S extends Readonly<
    Record<string, Readonly<Record<string, AnyStandardSchemaV1>>>
  >,
>(
  current: ReadonlyStore<CurrentAppOwner<S> | null>,
  onChange: (state: AppOwnerState<S>) => void,
): Unsubscribe;
```

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

Follows `current`, such as [EvoluApp.current](https://evolu.dev/docs/api-reference/common/local-first/Evolu/interfaces/EvoluApp#current), as an
[AppOwnerState](https://evolu.dev/docs/api-reference/common/local-first/Evolu/type-aliases/AppOwnerState), and calls `onChange` with the state at once and
whenever it changes. Another instance, as when the tab opens another
AppOwner, or the AppOwner again after a removal and restore or its database's
deletion, is `Opening` until its promise resolves, and then `Open`, so a UI
keyed by the instance remounts. Another [CurrentAppOwner](https://evolu.dev/docs/api-reference/common/local-first/Evolu/interfaces/CurrentAppOwner) with the same
instance keeps the state's type and instance, with the new `current`. An
instance that opens after the tab moved on changes nothing, and one that
never opens, as an aborted open's, leaves the state `Opening`. Once
unsubscribed, an instance that opens changes nothing.

The UI bindings follow the app with it, and so can an app without one.

### Example

```ts
import {
  assertType,
  subscribeAppOwnerState,
  type EvoluApp,
  type Name,
  type TestEvoluSchema,
  type Unsubscribe,
} from "@evolu/common";

// Renders the open AppOwner's database name, or what shows meanwhile.
const renderApp = (
  app: EvoluApp<TestEvoluSchema>,
  render: (text: Name | "Opening" | "None") => void,
): Unsubscribe =>
  subscribeAppOwnerState(app.current, (state) => {
    render(state.type === "Open" ? state.evolu.name : state.type);
  });

assertType<ReturnType<typeof renderApp>, Unsubscribe>();
```