coryhouse / coryhouse/react-restaurant-scriptpro

Create foods query factory; refactor menu + detail to useQuery

Open
#15 0 comments 0 reactions 0 assignees View on GitHub
enhancement phase-3-tanstack-query
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Goal
Centralize foods queries with a query-options factory, and refactor both menu and detail pages from manual `useEffect` to `useQuery`. Students should feel the difference: no more hand-rolled loading/error state, automatic caching, request deduping.

## Acceptance criteria
- [ ] `src/query-factories/foods.ts` exports `getFoodsQueryOptions()` and `getFoodByIdQueryOptions(id)`
- [ ] Menu page uses `useQuery` and no longer has `useState`/`useEffect` for data
- [ ] Detail page uses `useQuery` with the id param
- [ ] Loading and error states use the query's status fields
- [ ] Playwright menu test still passes

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/query-factories/foods.ts, then locate the menu and detail page entry points and review their current manual data-loading code. Refactor both to use the exported query options and query status fields, then run the Playwright menu test; done means the acceptance criteria are met and that test still passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.