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.
The "Filter applied" notification appears immediately on page load before the user has typed anything in the filter box.
The effect fires on mount - is that always the right time to show the toast?
The effect fires on mount - is that always the right time to show the toast?
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.