Repository navigation
Closed
Copy link
Description
Description
When a dine-in order is held (via the "Hold" button in the cart panel), it is stored only in browser localStorage (Zustand persist store) and never sent to the backend database. This means:
- The held order does not appear on the Orders page (which fetches from the API/DB)
- The held order does not appear on the Tables page (which checks DB table status)
- The held order is only visible in the
TablePickerModalwhen starting a new order — it shows a "HELD" badge on the table - The held order can be restored in the POS page by selecting that table again
- The held order is lost if localStorage is cleared, the browser is reset, or a different device/browser is used
- Other staff members cannot see or access held orders
Steps to Reproduce
- Open POS, select a table, add items to cart
- Click Hold → toast says "Order held for Table X"
- Go to Orders page → the held order is not listed
- Go to Tables page → the table shows as "Available" (not held/occupied)
- Open a new order, select dine-in, click a table → TablePickerModal shows "HELD" badge on that table
- But there's no way to see what items are in the held order from anywhere outside the POS cart
Root Cause
In frontend/src/store/held-orders.ts, the held orders Zustand store uses persist middleware which saves to localStorage:
export const useHeldOrdersStore = create<HeldOrdersState>()(
persist(
(set, get) => ({
orders: {},
holdOrder: (tableId, items, ...) => { /* saves to state/localStorage */ },
// ...
}),
{ name: 'held-orders' }
)
);The holdOrder function is called from CartPanel.tsx but never calls any backend API. The held order data never reaches the database.
Meanwhile:
- Orders page (
frontend/src/app/(dashboard)/orders/page.tsx) fetches orders from the API — held orders aren't there - Tables page (
frontend/src/app/(dashboard)/tables/page.tsx) checks table status from the API — held status isn't there - TablePickerModal (
frontend/src/components/pos/TablePickerModal.tsx) is the only component that reads from the held orders store
Expected Behavior
Held orders should be:
- Visible on the Orders page (with a "Held" status or separate section)
- Reflected on the Tables page (table should show as "Held" or similar status)
- Accessible from any device/staff member (stored in the backend, not just localStorage)
- recoverable even if the browser is reset
Suggested Approach
- Create a backend API endpoint to store/retrieve held orders (e.g.,
POST /api/held-orders,GET /api/held-orders) - Add a
heldstatus to the orders table in the database (or a separateheld_orderstable) - Update the
holdOrderfunction to call the API instead of (or in addition to) localStorage - Update the Orders page to show held orders
- Update the Tables page to reflect held status
- Keep localStorage as a fallback/offline cache for reliability
Environment
- Affects all platforms
- Affects all users viewing orders or tables (not just the person who held the order)
Activity