fix(kitchen-sink): show "No results" only after search is submitted#8
Conversation
The "No results found" message was displayed immediately as the user typed in the search box, before any search was performed. This made the search appear broken. Gate the message on a hasSearched flag that is only set when the form is actually submitted. https://claude.ai/code/session_01Uk5GnRn3EsB5cjHoXW4m5U
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35e05c3676
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| )} | ||
|
|
||
| {results.length === 0 && query.trim() && !loading && !error && ( | ||
| {results.length === 0 && hasSearched && !loading && !error && ( |
There was a problem hiding this comment.
Guard empty-state message when query is blank
Removing the query.trim() check makes the empty-state render for an empty input after any prior no-result search, because hasSearched stays true and results stays empty. In that flow, clearing the field shows No results found for '', which is misleading and regresses prior behavior where blank queries suppressed the message.
Useful? React with 👍 / 👎.
Summary
hasSearchedstate flag so the empty-results message only appears after the form is actually submittedTest plan
npm run devinexamples/kitchen-sinkhttps://claude.ai/code/session_01Uk5GnRn3EsB5cjHoXW4m5U