• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

immerjs / immer / 29524878876

16 Jul 2026 06:40PM UTC coverage: 45.698% (+0.2%) from 45.455%
29524878876

push

github

web-flow
fix: draft relocated base refs after reverse/sort in array-methods plugin (#1255)

With enableArrayMethods(), reverse() and sort() run natively on copy_,
which still holds raw base references. Reordering relocates an un-drafted
base object to an index where it no longer equals base_[prop], so the get
trap's positional check misses it and returns the raw base object. Writing
to that object mutates the user's base state, violating immer's guarantee
that the base state is never modified. Patches and inverse patches are
wrong too.

Detect a relocated base reference in the get trap (only after a reorder,
for indices the user did not explicitly assign) and draft it before
exposing it.

657 of 705 branches covered (93.19%)

Branch coverage included in aggregate %.

16 of 17 new or added lines in 2 files covered. (94.12%)

4 existing lines in 2 files now uncovered.

1717 of 4490 relevant lines covered (38.24%)

1871.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.11
/src/plugins/arrayMethods.ts


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc