Skip to content
Myr

docs: clarify that patches are not optimal. Solves #648

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

authored by Michel Weststrate · committed by Michel Weststrate · parent c0e6749 · Browse files · 2 files+3 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

2 files+3 added−0 removed

  • other:+3 added−0 removed

2 files+3 added−0 removed

modified:docs/patches.md+2 added
modified:docs/pitfalls.md+1 added
14 unmodified lines
151. Immer [does not support exotic objects](https://github.com/immerjs/immer/issues/504) such as window.location.161. You will need to enable your own classes to work properly with Immer. For docs on the topic, check out the section on [working with complex objects](https://immerjs.github.io/immer/docs/complex-objects).171. For arrays, only numeric properties and the `length` property can be mutated. Custom properties are not preserved on arrays.181. Note that data that comes from the closure, and not from the base state, will never be drafted, even when the data has become part of the new draft:191. The set of patches generated by Immer should be correct, that is, applying them to an equal base object should result in the same end state. However Immer does not guarantee the generated set of patches will be optimal, that is, the minimum set of patches possible.2021```javascript22function onReceiveTodo(todo) {23 const nextTodos = produce(todos, draft => {
12 unmodified lines