All findings
mediumNeeds reviewBugs & LogicSR-202

Unhandled promise on empty search

What is wrong

Searching with an empty string throws and blanks the page. Inferred from code — not reproduced at runtime.

Impact: White screen for users who clear the search box.

Evidence (fixture)

src/hooks/useSearch.ts:21–29 · commit a3f9c21

results.map(...) on undefined (fixture, inferred)
Expected
Empty query shows all notes.
Observed
Inferred crash path; needs runtime confirmation.

Recommended fix

Guard empty queries and add an error boundary.

Repair prompt for your AI builder

In useSearch.ts return an empty array for empty queries and handle fetch errors instead of throwing.

Paste it into Lovable, Claude Code, Cursor or Codex.