Description

A filterable list shows a "Filter applied" notification whenever the user changes the filter input. The notification should only appear after the user has typed something - not when the page first loads.

Anomaly

The "Filter applied" notification appears immediately on page load before the user has typed anything in the filter box.

Constraint
Do not remove the useEffect or change its dependency on filter
Hint
Consult the SenseiOnly for those truly stuck · Flip to reveal

The effect fires on mount - is that always the right time to show the toast?

Loading editor…
Correct Solution
Loading...

Why this fixes it

The broken code called setToast("Filter applied") unconditionally, so the effect fired on mount when filter was still an empty string and the toast appeared before the user had typed anything. Replacing the body with setToast(filter ? "Filter applied" : "") makes the toast directly reactive to the filter value - when filter is empty the toast is cleared, and when it is non-empty the toast is shown. This also correctly resets the toast when the user clears the input after typing, which the previous guard-based approach failed to handle.

Expected OutputGoal State
Your OutputLive