Skip to content

Conversation

@hwangdae
Copy link
Collaborator

@hwangdae hwangdae commented Jan 1, 2026

작업 내용

문제점 및 어려움

해결 방안

공유 사항

Summary by CodeRabbit

Release Notes

  • New Features

    • Redesigned menu selection interface with dedicated sections for menu information and quantity selection
    • Added modal confirmation when handling sold-out items during checkout
  • Bug Fixes

    • Enhanced error handling during order submission with improved user notifications
    • Fixed loading state management for better page transition feedback
  • Improvements

    • Optimized component rendering performance to reduce unnecessary updates
    • Improved overall ordering flow with clearer visual feedback and navigation

✏️ Tip: You can customize this high-level summary in your review settings.

@hwangdae hwangdae merged commit bf37316 into main Jan 1, 2026
2 of 3 checks passed
@github-actions github-actions bot requested a review from oriNuguri25 January 1, 2026 12:18
@coderabbitai
Copy link

coderabbitai bot commented Jan 1, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR optimizes component rendering with memoization (useCallback, React.memo), centralizes menu fetching via a new React Query hook (useStoreMenus), and refactors OrderListPage by extracting logic into a custom hook (useOrderListLogic) and presentational components. It includes minor prop renames (id → menuId), type improvements, and path corrections across both admin and user-facing apps.

Changes

Cohort / File(s) Summary
Performance Optimizations in AdminHome
apps/nowait-admin/src/pages/AdminHome/AdminHome.tsx, apps/nowait-admin/src/pages/AdminHome/components/WaitingCard.tsx
Added useCallback memoization to event handlers with updated dependency arrays in AdminHome; wrapped WaitingCard with React.memo and introduced custom areEqual comparator for prop comparison to stabilize references.
New Menu Fetching Hook
apps/nowait-user/src/hooks/order/useStoreMenus.ts
Created new React Query hook module exporting storeMenusQuery, useStoreMenus, and useStoreMenuList for fetching and selecting store menus data with conditional enabling based on storeId.
Menu Hook Integration in Store Pages
apps/nowait-user/src/pages/order/home/StorePage.tsx, apps/nowait-user/src/pages/waiting/storeDetail/StoreDetailPage.tsx
Replaced direct useQuery calls with new useStoreMenus hook; removed inline menu-fetching logic and console.log.
AddMenu Page Refactoring
apps/nowait-user/src/pages/order/addMenu/AddMenuPage.tsx, apps/nowait-user/src/pages/order/addMenu/components/MenuInfoSection.tsx, apps/nowait-user/src/pages/order/addMenu/components/MenuOrderSection.tsx
Refactored AddMenuPage to use useStoreMenus hook with quantity state and useMemo for totalPrice; extracted menu display and quantity controls into MenuInfoSection and MenuOrderSection presentational components.
OrderList Page & Components Major Refactoring
apps/nowait-user/src/pages/order/orderList/OrderListPage.tsx, apps/nowait-user/src/pages/order/orderList/hooks/useOrderListLogic.ts, apps/nowait-user/src/pages/order/orderList/components/CartList.tsx, apps/nowait-user/src/pages/order/orderList/components/OrderFooter.tsx, apps/nowait-user/src/pages/order/orderList/components/SoldOutModal.tsx
Extracted order list state and business logic into useOrderListLogic hook; created CartList, OrderFooter, and SoldOutModal components to replace inline rendering and modal management; refactored to delegate state and handlers to hook.
CartItem Prop Renaming
apps/nowait-user/src/pages/order/orderList/components/CartItem.tsx
Renamed id prop to menuId across PropsType interface and component usage to clarify semantics.
Order & Type Refinements
apps/nowait-user/src/pages/order/orderDetails/OrderDetailsPage.tsx, apps/nowait-user/src/pages/order/remittenceWait/RemittanceWaitPage.tsx
Added as const to statusMap for literal type inference and new OrderStatus type alias in OrderDetailsPage; refactored RemittanceWaitPage error handling and loading state management with unified success-check and toast on error.
Import Path Corrections
apps/nowait-user/src/pages/order/home/components/RedirectToStorePage.tsx, apps/nowait-user/src/routes/Router.tsx
Fixed import paths: RedirectToStorePage relative path depth and Router import for RedirectToStorePage component location.

Sequence Diagram(s)

sequenceDiagram
    participant OLP as OrderListPage
    participant UOL as useOrderListLogic
    participant CartStore as CartStore
    participant RQ as React Query
    participant API as API
    participant Modal as SoldOutModal
    participant Nav as Navigation

    OLP->>UOL: initialize hook
    UOL->>CartStore: getCart()
    CartStore-->>UOL: cart array
    
    rect rgb(200, 220, 255)
    Note over UOL,API: Menu Fetching Phase
    UOL->>RQ: useStoreMenuList(storeId)
    RQ->>API: getStoreMenus(storeId)
    API-->>RQ: menu data
    RQ-->>UOL: menus with menuReadDto
    end
    
    rect rgb(255, 220, 200)
    Note over UOL,Modal: Sold-Out Check & Modal Flow
    UOL->>UOL: getSoldOutMenusInCart(cart, menus)
    alt Sold-Out Items Found
        UOL->>Modal: modal.open()
        OLP->>Modal: render SoldOutModal
        Modal-->>OLP: user clicks confirm
        OLP->>UOL: handleRemoveSoldOutMenus()
        UOL->>CartStore: removeFromCart(menuIds)
        UOL->>Modal: modal.close()
    else No Sold-Out Items
        UOL->>Nav: navigate to remittance page
    end
    end
    
    OLP->>OLP: render with hook state (cart, isAnimatingOut, modal, soldOutMenus)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Develop #384 — Modifies menu/order API call sites (AddMenuPage, StorePage, StoreDetailPage) and affects getStoreMenus argument type resolution, directly intersecting with this PR's menu hook usage.
  • merge to main #334 — Refactors store menu fetching and rendering in nowait-user (MenuList props, StoreHeader, StorePage/StoreDetailPage data sources), overlapping with menu hook integration changes.
  • Develop #392 — Modifies WaitingCard.tsx styling and time calculations, conflicting with this PR's WaitingCard memoization changes.

Suggested reviewers

  • dgKim1

🐰 Hops excitedly with newly memoized tail
Hooks extract wisdom, components compose grace,
Menu fetching flows in one unified space!
OrderLists now dance with extracted delight—
Memos and callbacks make rendering light. ✨

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c1a8cfe and 8ce6e91.

📒 Files selected for processing (18)
  • apps/nowait-admin/src/pages/AdminHome/AdminHome.tsx
  • apps/nowait-admin/src/pages/AdminHome/components/WaitingCard.tsx
  • apps/nowait-user/src/hooks/order/useStoreMenus.ts
  • apps/nowait-user/src/pages/order/addMenu/AddMenuPage.tsx
  • apps/nowait-user/src/pages/order/addMenu/components/MenuInfoSection.tsx
  • apps/nowait-user/src/pages/order/addMenu/components/MenuOrderSection.tsx
  • apps/nowait-user/src/pages/order/home/StorePage.tsx
  • apps/nowait-user/src/pages/order/home/components/RedirectToStorePage.tsx
  • apps/nowait-user/src/pages/order/orderDetails/OrderDetailsPage.tsx
  • apps/nowait-user/src/pages/order/orderList/OrderListPage.tsx
  • apps/nowait-user/src/pages/order/orderList/components/CartItem.tsx
  • apps/nowait-user/src/pages/order/orderList/components/CartList.tsx
  • apps/nowait-user/src/pages/order/orderList/components/OrderFooter.tsx
  • apps/nowait-user/src/pages/order/orderList/components/SoldOutModal.tsx
  • apps/nowait-user/src/pages/order/orderList/hooks/useOrderListLogic.ts
  • apps/nowait-user/src/pages/order/remittenceWait/RemittanceWaitPage.tsx
  • apps/nowait-user/src/pages/waiting/storeDetail/StoreDetailPage.tsx
  • apps/nowait-user/src/routes/Router.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot mentioned this pull request Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants