Close the earlier lessons and work from the brief. The starter is a session log
with a chart and 10,000 sessions. Typing in the filter is slow. WindowedList
from the last lesson is included.
The brief
- Measure first. Type one letter and read the Profiler lines. Write down what renders and how long each takes. In our tests, every keystroke cost about 30 ms for the chart, and between 60 and 230 ms for the list, depending on how many sessions matched.
- Stop the chart re-rendering while typing, without
memo. - Make the list cheap with
WindowedList, keeping the same rows and the 10,000 sessions match count.
Acceptance checks:
- Typing logs no Chart lines at all.
- Compare the same query before and after: List update takes less time. Record your own durations; a fixed millisecond target isn't the pass condition.
- The page holds about a dozen rows, however many match.
Runs with Vite on your computer: unzip, then
npm install and npm run dev. Hint 1: the chart
Only the filter and the list use query. Move them, with the state, into a new
SessionSearch component.
Hint 2: the list
<WindowedList items={matches} rowHeight={32} height={224} renderRow={...} />,
inside the List profiler.
Show one solution
Runs with Vite on your computer: unzip, then
npm install and npm run dev. Check yourself
- What does
actualDurationmeasure? - Why is moving state down usually better than wrapping a component in
memo? - What does
Activitydo with a hidden component's effects?
Completion is saved in this browser only. It does not measure mastery.