You need cancellation on top of the debounce. The timer stops extra requests; a cancelled flag stops stale responses.
The cleanup runs before the next effect, so any in-flight response from a previous query is discarded rather than applied. With fetch you can go further and pass an AbortController signal so the request is dropped on the wire.