rocicorp / replicache

Realtime Sync for Any Backend Stack
https://doc.replicache.dev
1.06k stars 38 forks source link

User request: sample of more complex mutation validation #924

Open aboodman opened 2 years ago

aboodman commented 2 years ago

See original request here: https://github.com/rocicorp/replicache-todo/issues/2.

This could make sense in Replidraw, for example, some upper limit on number of objects on page or something?

aboodman commented 2 years ago

Not exactly "validation", but this new createTodo mutator ensures that there are not duplicate sort fields by assigning the next highest value from all current values:

https://github.com/rocicorp/replicache-todo/blob/main/frontend/todo.ts#L44