Skip to content

Conversation

jonhella
Copy link
Member

Closes #55
Closes #57
Closes #59

What and why

  • Add ingredient autocomplete with typo tolerance, alternative names and indexed PostgreSQL search.
  • Debounce requests, cache suggestions and handle loading, empty results and API errors.
  • Persist fridge ingredients with Zustand and localStorage across navigation and page refreshes, with synchronization between browser tabs.
  • Match recipes using any fridge ingredient, so unused ingredients do not exclude relevant recipes.
  • Add a “Back to Fridge” link when no recipes match.

How to test

  1. Run npm run ingredients:refresh against an existing recipe database.
  2. Start the backend and frontend.
  3. Search for tomatoe in My Fridge and select tomato.
  4. Add another ingredient, navigate away and return, then refresh. Verify the list remains.
  5. Find recipes with tomato and pepper. Verify tomato recipes appear.
  6. Search with ingredients that have no matches and verify “Back to Fridge” returns to the saved list.

Validation: 40 frontend tests pass, including matching and persistence tests. Database tests cover fuzzy matching and index usage with 50,000 synthetic entries. Lint, typecheck, formatting and production build pass.

Screenshots: not attached.

AI usage

AI assisted with implementation, documentation and automated tests. Manual code review and browser verification remain before merge.

Checklist

  • Linked issue, labels and milestone set
  • Lint and tests pass locally
  • Tests added/updated for new logic
  • Accessibility manually verified
  • README/CLAUDE.md updated
  • No secrets or personal data committed

Add indexed PostgreSQL search with fuzzy matching and ingredient aliases.

Support debounced suggestions, caching, keyboard navigation and error feedback.

Test matching, index usage and catalog refresh with 50,000 synthetic entries.

Closes #55
Persist fridge ingredients across navigation and reloads using Zustand and localStorage, and sync changes between browser tabs.

Match recipes using any available fridge ingredient and provide a Back to Fridge link when no recipes match.

Closes #57

Closes #59
@jonhella jonhella requested a review from a team as a code owner October 15, 2026 10:14
Copy link
Member

@davidhne davidhne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, ill fix the backend accordingly

@davidhne davidhne merged commit b151040 into main Oct 15, 2026
davidhne pushed a commit that referenced this pull request Oct 15, 2026
Replaces frontend/src/mocks/recipes.ts with Apollo Client queries against
the backend, so search, category/rating filtering, sorting and "Load
more" paging all run server-side over the whole dataset, as required.

- Apollo Client chosen as the GraphQL client; its cache also satisfies the
  assignment's state-management requirement for server data (Zustand,
  merged separately via #60, covers local Fridge UI state)
- Vite dev proxy for /project2/graphql mirrors the Apache proxy in
  production, and honors VITE_GRAPHQL_URL like IngredientSearch.tsx does
- Fixed a real bug found while wiring this up: RecipeFilter's category
  values were lowercase ("beef"), but the server does a case-sensitive
  array-contains match against Title Case data ("Beef") - every category
  filter would have silently returned zero results
- "My Fridge" ingredient matching still happens client-side on the loaded
  page only; the backend has no ingredient filter yet (follow-up issue).
  The any-ingredient-matches semantics and "Back to Fridge" link are from
  #60, rebased on top of here together with their HomePage/test changes
- Loading and error states, aria-live reads the server's totalCount

Closes #58

AI usage: Claude Code wrote the implementation and tests in this commit,
driven by a reviewed plan; manually verified end-to-end in a browser
against a local backend/Postgres with the real dataset (search, category
filter, pagination, detail page, Fridge flow), both before and after
rebasing onto #60's merged ingredient-autocomplete/Fridge-persistence work.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
2 participants