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
The core idea is to use [Immer](https://immerjs.github.io/immer/) as an interface for state mutations and provide a convenient way to group mutations into a single transaction.
3
-
As an end-result, we get patches that can be used to sync the app state across the application and to sync the changes to the server. This also gives us a way to undo/redo a transaction automatically.
4
+
5
+
Using Immer's patches we sync the state across the application and to the server. This also gives us a way to undo/redo a transaction automatically.
4
6
5
7
## Features
6
8
7
9
1. Update application state using [patches](https://immerjs.github.io/immer/patches)
8
-
2. Synchronize with the server
10
+
2. Synchronize to the server
9
11
3. Get undo/redo on the client that does both updating the client state and syncing to the server
1. To define a namespace for each container so that whoever consumes the changes knows which object to apply the patches to.
82
87
2. Ensure that the container was intentionally registered to be synced to the server and be part of undo/redo transactions. You may not want this for every container since you can use them for ephemeral states.
83
88
84
89
Example
85
90
86
91
```js
87
-
register('myName', myContainer)
92
+
register("myName", myContainer);
88
93
```
89
94
90
95
### Creating a transaction
@@ -100,11 +105,14 @@ A call into `createTransaction()`does all of this:
0 commit comments