Repository navigation
Conversation
|
Marked mergable per #1335 (comment). Might be good to have some rationale why this is important to have; not allocating that field could also be considered a feature? |
|
My rationale is consistency with #1160: assigning an inherited For This was an independently found edge case; I do not have a production use case to add. I understand the cost and future-implementation concern: it adds ownership checks to assignment. Whether this distinction belongs in Immer's contract is an API policy decision. If a concrete consumer is needed to justify that cost, this can remain deferred until one exists. |
Assigning a prototype's existing value to a draft should create an own property. Currently,
draft.name = "default"is ignored whenname: "default"is inherited; the result has no ownnameand no corresponding patch.Only skip equal-value assignments when the property is already owned by the base or copy. This also covers inherited
NaNvalues and drafts that were modified earlier in the recipe.Tests check property ownership, prototype preservation, and forward/inverse patches. Validation:
yarn test,yarn coverage, andyarn test:perfon Node 24.21.0; the same checks also passed on Node 22.23.2.