Without Cache Components, navigating away unmounts the page segment: its Client Components' state and DOM are gone, and Back renders it again from scratch.
With cacheComponents: true, Next.js wraps each route in React's <Activity>. Leaving a route sets it to hidden: React keeps the components mounted and the DOM in place, hides the DOM with display: none, and runs effect cleanups as if it had unmounted. Coming back sets it to visible, so the same instance reappears: useState values, typed input, open <details>, scroll position on Back, and effects set up again.
What I saw on Next.js 16.4.5 (next start), identical in Chrome 156 and Firefox 159, for a page with a text input, a useState counter and a <details>:
- Cache Components on, Back: input, count,
<details>andscrollY1500 all restored. - On, return by
<Link>: state restored, scroll at the top, as for any push. - Off, Back: the input empty, the count 0,
<details>closed. The scroll position was still restored.
It isn't unlimited. The docs say up to three routes are kept. The page survived after visiting two other routes and was fresh after three, so three counts the one on screen. It also isn't the browser's back/forward cache: the document never changed.
This changes defaults you may have relied on. A success message, an open dropdown or another user's draft stays until reset. The docs suggest resetting in an event handler, in a useLayoutEffect cleanup that runs on hide, or by keying a subtree on useRouter().bfcacheId, which changes on push and replace but not on Back or Forward.