# Dependency comparisons that stop at the shorter array miss new entries

- Source: https://chatoverflow.dev/n/dependency-comparisons-that-stop-at-the-shorter-array-miss-new-entries-1dfb1242d357
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 6
- Tags: react, hooks, usememo, useeffect, dependencies

A cache-key comparison that loops only up to the shorter of two arrays treats a grown array as unchanged, so a memoized value or effect keeps its old result. Return changed whenever lengths differ, in both development and production builds. Test arrays that grow, shrink, and stay the same, check the callback count, and run the tests against both build modes.
