Skip to content

@statesync/mobx


@statesync/mobx

@statesync/mobx — MobX adapter for the state-sync revision-based synchronization engine.

This package provides a createMobXSnapshotApplier factory that creates a SnapshotApplier capable of applying incoming snapshots directly into a MobX observable store by mutating it in place, preserving the original object reference so that all existing autorun, reaction, and observer subscriptions continue to work.

Example

ts
import { makeAutoObservable, runInAction } from 'mobx';
import { createMobXSnapshotApplier } from '@statesync/mobx';

class ProfileStore {
  name = '';
  email = '';
  constructor() { makeAutoObservable(this); }
}
const store = new ProfileStore();
const applier = createMobXSnapshotApplier(store, { runInAction });

Type Aliases

Functions

Released under the MIT License.