In plain words
Nested data is objects and arrays stored inside each other, like an order holding a list of items that each hold their own details.
Where you see it
A QuickBite order from the API holds a restaurant object, an items array and a delivery object with an address inside it. To reach the city, the code walks down each layer: order.delivery.address.city.
What goes wrong
- One missing layer crashes the page
Pickup orders have no delivery object, so order.delivery.address throws "Cannot read properties of undefined". Optional chaining, order.delivery?.address, returns undefined instead.
- Guessing the shape instead of checking it
The agent assumes the items sit at the top level when the API puts them one layer down. Log one real response and read it before writing code against it.
- Copying the outer layer, editing an inner one
{ ...order } copies only the top layer. Change copy.delivery.address and the original order changes with it.
const copy = { ...order }; copy.delivery.address.city = "Porto";
What to tell your agent
Quick check
Sign in to earn +10 XP for itA pickup order crashes QuickBite's order page with "Cannot read properties of undefined (reading 'address')". What's missing?