Symptom
When the user rapidly switches exercise types (e.g. Strength -> Cardio -> Flexibility), the displayed results sometimes show exercises from a previously selected type. For instance, after selecting "Flexibility", the list may suddenly show Cardio exercises because the Cardio request took longer and resolved after the Flexibility request.
Expected
Only the results from the most recently selected type should be displayed. Older requests that resolve late should be discarded.
What you know
Each filter change triggers an async fetch. There is no mechanism to cancel or ignore stale requests. If request A (slow) resolves after request B (fast), A's stale data overwrites B's correct data.
Hints
TypeScript
TypeScript ready
Test Output
▶
Click "Run Tests" to execute your code