A name search panel uses memoization to recompute its filtered list only when the search query changes.
Click the Like button - the filter run counter increments even though the search query never changed. After three likes the counter shows 4 runs despite only one query having been entered.
useMemo recomputes whenever any value in its dependency array changes - are all listed dependencies actually used inside it?
useMemo recomputes whenever any value in its dependency array changes - are all listed dependencies actually used inside it?
Why this fixes it
`likes` was listed in the dependency array but is never read inside the useMemo callback - only `query` is used. Every Like button click updated `likes`, which invalidated the memo and triggered an unnecessary filter recomputation. Removing `likes` from the dependency array means the memo only reruns when `query` actually changes.