Skip to content
Myr

docs: add a note about patch serialization for Maps

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by keenondrums · committed by Alec Larson · parent 6501ec5 · Browse files · 1 file+2 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−0 removed

  • other:+2 added−0 removed

1 file+2 added−0 removed

modified:readme.md+2 added
336 unmodified lines
337For a more in-depth study, see [Distributing patches and rebasing actions using Immer](https://medium.com/@mweststrate/distributing-state-changes-using-snapshots-patches-and-actions-part-2-2f50d8363988)338339Tip: Check this trick to [compress patches](https://medium.com/@david.b.edelstein/using-immer-to-compress-immer-patches-f382835b6c69) produced over time.340341> Be aware, if you non-primitive values as keys for your `Map` you can no longer serialize patches produces by `immer`. There won't any errors, but the result might be not what you expect.342343## Async producers344345It is allowed to return Promise objects from recipes. Or, in other words, to use `async / await`. This can be pretty useful for long running processes, that only produce the new object once the promise chain resolves. Note that `produce` itself (even in the curried form) will return a promise if the producer is async. Example:346
412 unmodified lines