As stated in the automerge documentation: "As a general principle you should make state updates at the most fine-grained level possible. Don’t replace an entire object if you’re only modifying one property of that object; just assign that one property instead".
Now we directly patch the whole property for complex types like arrays or subobjects. While it is acceptable when online because we always start from a "fresh" version when editing, it is not appropriate when offline as the object we start from might be old and have a completely different structure than the current one.
When patching we should try to compare previous and current property content on complex types and try to apply appriopriate automerge atomic operations instead of a whole replacement.
As stated in the automerge documentation: "As a general principle you should make state updates at the most fine-grained level possible. Don’t replace an entire object if you’re only modifying one property of that object; just assign that one property instead".
Now we directly patch the whole property for complex types like arrays or subobjects. While it is acceptable when online because we always start from a "fresh" version when editing, it is not appropriate when offline as the object we start from might be old and have a completely different structure than the current one.
When patching we should try to compare previous and current property content on complex types and try to apply appriopriate automerge atomic operations instead of a whole replacement.