segment.revision is no longer a getter to resolve the referenced entity. Instead, it's the actual value of the referenced entity at the moment of the "segment" update.
Root cause
The issue is caused by spreading the updated entityChunk when performing update:
When the object is spread its getters are resolved. Instead, we should clone the entityChunk while preserving its getters (any property descriptors, really).
Steps to reproduce
segment.revision
is no longer a getter to resolve the referenced entity. Instead, it's the actual value of the referenced entity at the moment of the "segment" update.Root cause
The issue is caused by spreading the updated
entityChunk
when performingupdate
:https://github.com/mswjs/data/blob/0970e7ed5a9094d6618ed6563f8bb3a00d5c9ecc/src/model/updateEntity.ts#L120
When the object is spread its getters are resolved. Instead, we should clone the
entityChunk
while preserving its getters (any property descriptors, really).