Skip to content

Search: persistent recent searches + clear input on pop

jedmund requested to merge jedmund/sao-paulo-v7 into main

Created by: jedmund

Summary

  • Adds a UserDefaults-backed RecentSearchesStore that keeps the user's last 10 tag submissions, LRU-promoted on repeat, JSON-encoded under recentSearches.v1.
  • SearchView surfaces the list below the input whenever the field is empty; suggestions take over the moment any text is typed. No dividers between rows per design.
  • Tapping a recent row performs the search instantly (no intermediate field-fill).
  • performSearch records every submission (including keyboard-submitted raw text) and clears searchText post-push, so popping back from a feed lands on a clean Search screen showing recents.

Test plan

  • Type a query, pick a suggestion → feed pushes; pop back → field is empty, recent appears at the top of the list
  • Type raw text, hit return → same behavior; recent with no translation
  • Submit the same query twice → one entry, most recent on top
  • Submit 11 distinct queries → only the 10 most recent are kept
  • Kill the app and relaunch → recents persist
  • Start typing → recents hide, suggestions take over
  • Clear the field via the X → recents return

🤖 Generated with Claude Code

Merge request reports

Loading