Symptom
The leaderboard's expensive sort-and-slice computation runs on every render, even when neither the data nor the sort options have changed. Profiling shows useMemo is not caching at all. Typing in an unrelated input field triggers a full re-sort.
Expected
The sorted leaderboard should be memoized and only recomputed when entries, sortBy, or limit actually change.
What you know
The useLeaderboard hook receives an options object with sortBy and limit and uses useMemo to cache the sorted result. Despite using useMemo, the computation runs on every call.
Hints
TypeScript
TypeScript ready
Test Output
▶
Click "Run Tests" to execute your code