intermediateState

Put the Filters Where They Belong

Decide what you would build from the brief alone. Everything below it is available, but the exercise stops working if you open it first.

The brief you were given

A reports page has a date range, a status filter, a text search and a page number, all held in component state. Users complain they cannot share a filtered report, and the back button loses their filters. Fix it.

The trap — the wrong fix that looks right

Syncing the filter state to localStorage so it survives a reload, which fixes the most-reported symptom and is quick. The shared link still shows unfiltered results, so the original complaint is untouched; Back still does not restore, because nothing wrote a history entry; and a new failure appears — two people on a shared machine, or one person in two tabs, now see each other's filters, because localStorage is scoped to the origin and not to the view. Persistence answers "does it survive a reload". It does not answer "what is this page showing", which is the question the filters actually are.