Skip to content

Held orders only stored in localStorage — invisible on Orders and Tables pages #17

Closed

Description

@khaira777

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 TablePickerModal when 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

  1. Open POS, select a table, add items to cart
  2. Click Hold → toast says "Order held for Table X"
  3. Go to Orders page → the held order is not listed
  4. Go to Tables page → the table shows as "Available" (not held/occupied)
  5. Open a new order, select dine-in, click a table → TablePickerModal shows "HELD" badge on that table
  6. 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:

  1. Visible on the Orders page (with a "Held" status or separate section)
  2. Reflected on the Tables page (table should show as "Held" or similar status)
  3. Accessible from any device/staff member (stored in the backend, not just localStorage)
  4. recoverable even if the browser is reset

Suggested Approach

  1. Create a backend API endpoint to store/retrieve held orders (e.g., POST /api/held-orders, GET /api/held-orders)
  2. Add a held status to the orders table in the database (or a separate held_orders table)
  3. Update the holdOrder function to call the API instead of (or in addition to) localStorage
  4. Update the Orders page to show held orders
  5. Update the Tables page to reflect held status
  6. 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions