Question presented to candidate: "A user edits an item, clicks Back, and sees the old value. Explain what the Router Cache is, why this happens, and how you fix it."
What a strong answer should cover:
- The Router Cache (called the Client Cache in the Next.js 16 docs) is an in-memory browser cache of RSC payloads for visited and prefetched routes.
- Back and forward navigation reuse stored payloads without a request; that is where stale screens come from.
- Since Next.js 15, pages of dynamic routes are not reused on normal link navigation (
staleTimes.dynamicdefaults to 0); static routes are kept for 5 minutes. - It is cleared by a full reload,
router.refresh(), and byrevalidatePath,revalidateTag,updateTagor setting cookies inside a Server Action. - Layouts and loading states are reused across navigations, which is what makes navigation feel instant.
Clarifying questions expected:
- "Was the mutation a Server Action or an API call?" β only the former can revalidate the client cache in the same response.
- "Is the stale screen on Back or on a link click?" β Back always reuses.
Code / implementation expected: Yes β a Server Action that revalidates, and a client refresh.