npm.io
0.1.2 • Published 2d ago

rvlib-pb-mobx

Licence
MIT
Version
0.1.2
Deps
0
Size
41 kB
Vulns
0
Weekly
0

rvlib-pb-mobx

MobX data layer for PocketBase apps: per-collection record + query caches, optimistic updates with rollback, debounced autosave, 50 ms write batching, rate limiting. Extracted from a production app.

bun add rvlib-pb-mobx pocketbase mobx
import { configurePbMobx, ObservableCollection } from 'rvlib-pb-mobx'
import PocketBase from 'pocketbase'

const pb = new PocketBase('https://your-instance.pockethost.io')
configurePbMobx({ pb, notify: (n) => console.log(n.color, n.message) }) // wire your toast lib here

const todos = new ObservableCollection(pb.collection('todos'))
const q = todos.getList(1, 50) // observable, cached, render-synchronous

Subpath exports: rvlib-pb-mobx/migrate (additive migration helpers), rvlib-pb-mobx/testing (in-memory PocketBase stub for bun tests).

Built-in notification messages are in French — override them per call via the labels option, or globally through your notify callback.