Immer invokes Object.freeze on non-primitive values such as arrays and objects. This is how it achieves immutability. This presents two problems for the Yjs middleware:
Client updates must obey Immer's rules for modifying objects and arrays (annoying but doable).
State updates triggered on the client by a peer need to either:
a. Invoke Immer's produce function (unfavorable coupling), or
b. Detect if the object to modify is frozen or otherwise inextensible and treat it as immutable.
See #53.
Immer invokes
Object.freeze
on non-primitive values such as arrays and objects. This is how it achieves immutability. This presents two problems for the Yjs middleware:produce
function (unfavorable coupling), or b. Detect if the object to modify is frozen or otherwise inextensible and treat it as immutable.