Remote / foldkit-remote/persistence

PersistenceWiring

interface · packages/remote/src/persistence.ts:701

interface PersistenceWiring<AppModel> extends Wiring<
  AppModel,
  RemoteMessage,
  KeyValueStore.KeyValueStore
> {
  readonly restore: (
    model: AppModel,
  ) => Effect.Effect<AppModel, never, KeyValueStore.KeyValueStore>
}

persistence's wiring, and the restore its runtime's init starts from.

Members

PersistenceWiring.restore

property · packages/remote/src/persistence.ts:713

readonly restore: (
  model: AppModel,
) => Effect.Effect<AppModel, never, KeyValueStore.KeyValueStore>

The Model with the snapshot stored under its key restored, as the wiring would restore it. Resolve it as the runtime's flags and start init from it, so the first frame draws the stored rows; the wiring then restores only when key changes. A store it cannot read leaves the Model as it is, and the wiring tries again.