Part 12 / Topic 6 of 7
Choosing updateTag — read-your-own-writes, finished this time
Part 11, section 5 could only describe updateTag's shape from the outside, forward-referencing this part for the full build. Here it is, in context: submitReview calls updateTag("swiggy-reviews") right after writing the new review and right before redirect()-ing. The installed server-actions.md guide's own rule for why this specific function, not revalidateTag:
"Calls
updateTagorrevalidatePathto immediately invalidate cached data... A re-render is included in the same response."
Verified for real, reading the response headers from section 2's successful submission:
$ curl -s -D - -X POST http://localhost:PORT/swiggy-menu/reviews -F ...(valid fields)...
HTTP/1.1 303 See Other
Location: /swiggy-menu/reviews?posted=1
x-action-revalidated: 1
x-action-revalidated: 1 is this install's own real confirmation that the re-render happened inside this same request — not a separate background job, not something the next page load merely benefits from. Following the redirect shows the new review present on the very next page load, with no stale window in between, because updateTag (unlike revalidateTag("swiggy-reviews", "max")) never serves a stale copy at all. A reviewer posting their own review is exactly the case the installed docs name for updateTag: "designed for read-your-own-writes scenarios, where a user makes a change... and the UI immediately shows the change, rather than stale data."
Done here? The practice set for Part 12 — including the solutions — is on the part page.