The cart stays stale after Add to cart

A shopper adds a tote, but the cart count and subtotal stay the same. Follow the successful write and the stale read that makes it look like nothing happened.

Reproduce the issue

Add the tote to the original app and inspect the cart read. Refresh the cart to see the item appear, then compare with the version that fetches a fresh cart.

field-supply.example/shop/canvas-day-tote
FIELD SUPPLYMade for the everyday
Cart 1
THE EVERYDAY COLLECTION01 / Canvas day tote

Everyday carry

Canvas day tote

$24.00

A sturdy, go-anywhere tote. Room for your laptop, a good book, and the long way home.

Sand · Natural canvas
Materials & dimensions

18 oz cotton canvas. Reinforced handles and an inside pocket. 38 × 34 × 12 cm; 16 L capacity.

Your cart 1

  • Trail bottle Sage · 500 mlQty 1$18.00
Subtotal · 1 item$18.00

$32.00 away from free shipping

Request trace

0 events
No requests yet

The next app action starts the trace.

What the trace shows

The write creates a line item and advances the cart to version 18. The next read in the original app uses a cached version 17, so the UI still shows one item. Compare the source and the version of each response before changing the write path.

Change the app

After the write succeeds, invalidate the cart cache for this shopper and fetch the updated cart. Render the returned line items, count and subtotal together. The same write succeeds in both versions of this sample.

Verify the result

  • The cart shows the new tote exactly once, updates the count to two and shows a $42.00 subtotal without a manual refresh.
  • The trace shows one successful write followed by a fresh read of the updated cart.
Model an API workflow with state