You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dispatch(todo.create.commit(item.id)); // server confirmed — becomes committed state
97
+
dispatch(todo.create.fail(item.id, error)); // server rejected — dropped (DISPOSABLE)
103
98
```
104
99
100
+
> `createCrudTransitions` composes `crudPrepare` + `createTransitions` with golden-path modes: **DISPOSABLE** create, **DEFAULT** update, **REVERTIBLE** remove. For custom modes or per-operation preparators, use `crudPrepare` + `createTransitions` directly.
101
+
105
102
---
106
103
107
104
## Three Rules
@@ -117,8 +114,13 @@ dispatch(createTodo.fail(todo.id, error)); // server rejected — flagged as fai
117
114
Entities need a **monotonically increasing version** — `revision`, `updatedAt`, a sequence number. This is how sanitization tells "newer" from "stale":
118
115
119
116
```typescript
120
-
compare: (a, b) =>0|1|-1; // version ordering
121
-
eq: (a, b) =>boolean; // content equality at same version
117
+
// Shorthand — extracts version, compare is generated automatically
118
+
version: (item) =>item.revision,
119
+
eq: (a, b) =>boolean,
120
+
121
+
// Full control — provide your own compare
122
+
compare: (a, b) =>0|1|-1,
123
+
eq: (a, b) =>boolean,
122
124
```
123
125
124
126
Without versioning, conflict detection degrades to content equality only.
@@ -227,8 +229,6 @@ All selectors are returned from `optimistron()` on the `selectors` object — th
0 commit comments