Replies: 1 comment
-
My experience is: you should not mutate it, but a shallow clone suffices. Don't remember exactly what the effect was of mutating. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I have a question about using optimisticData function, as it looks from this docs, the currentData parameter should be treated as immutable, creating new object upon return (same as Redux's reducers).
But after some tests i found that even when treating it as mutable everything still works fine, moreover, when i tried to implement object cloning (for immutability) things starts to break and sometime cause the optimisticData no to work at all.
For example, the key
/examples
saves a list of object of type{id:1, exmple: true}
.how should i implement an optimisticData function:
immutably:
or mutably:
Also, if immutably is the right approach, should a shallow copy be suffice? or do i need to implement something like
_.deepClone()
?Beta Was this translation helpful? Give feedback.
All reactions