Clicking the heart flips the liked state and adjusts the count before the network request resolves. When POST /api/lab/like succeeds the UI keeps the optimistic value; when it fails the component reverts both the liked flag and the count, then shows an error.
Tick Force failure to make the request hit ?fail=1, which always responds 500 — the rollback branch only runs in that case.