This is an interesting problem, and I can see why it’s confusing. Since your useCallback depends on windowSize, it should only trigger when windowSize changes. But from what you’re describing, it sounds like something else might be causing the callback to run.
One thing to watch out for is whether the parent component re-renders whenever you update searchValue. Even though searchValue isn’t part of the useCallback dependency array, a re-render at the parent level could cause the function to be re-invoked.
It might help to log both windowSize and searchValue to figure out what’s actually triggering the callback. Also, double-check how windowSize is being updated—it’s possible something subtle is happening there.
Let me know if this helps or if you want to share more of the code. Happy to help dig into it!