immer icon indicating copy to clipboard operation
immer copied to clipboard

fix: Freezing of Map values during finalization

Open chetan-satpute opened this issue 1 year ago • 0 comments

Findings

Map keys are not enumerable properties of the Map object, so the propertyIsEnumerable check does not apply to them. This fails the check in finalizeProperty of src/core/finalize.ts.

Changes

  • Added a condition to detect Map objects and uses Map.prototype.has to check for key existence.

Fixes #1119

chetan-satpute avatar Nov 15 '24 21:11 chetan-satpute