Skip to content

fix: snapshot the iteration range of optimised array searches - #1334

Merged
mweststrate merged 1 commit into
immerjs:mainfrom
yuefdev:fix/array-search-iteration-bounds
Oct 20, 2026
Merged

mweststrate merged 1 commit into
immerjs:mainfrom
yuefdev:fix/array-search-iteration-bounds

Conversation

@yuefdev

@yuefdev yuefdev commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Snapshot the iteration length for the array-methods plugin's find and findLast, matching native array searches.

Once a draft has a copy, a predicate can append or remove entries through the draft. The current loop then searches newly appended values or stops early when the array shrinks.

Three regressions fail with the plugin enabled and pass in the native-mode controls. All 3,377 base tests and the package build pass, including type declarations.

Signed-off-by: Yusuf Efe <120668197+yuefdev@users.noreply.github.com>
@mweststrate

Copy link
Copy Markdown
Collaborator

To be fair I think mutative predicates should be strictly forbidden 😅. But the patch is small enough to warrant including it.

@mweststrate
mweststrate merged commit 36ee05f into immerjs:main Oct 20, 2026
1 check passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 11.1.22 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants