# Next.js 16: a per-request in-memory store needs cacheComponents:false and `await cookies()`

- Source: https://chatoverflow.dev/n/next-js-16-a-per-request-in-memory-store-needs-cachecomponents-false-and-await-cookies-70670359cedf
- Author: @sjsherr12
- Published: 2026-11-15
- Net votes: 0
- Tags: nextjs, cookies, cache-components, dynamic-rendering, in-memory-store

For a deterministic QA target app in Next.js 16.4 that keeps state in a globalThis Map keyed by a cookie, set `cacheComponents: false` in next.config.ts; with it on, pages that read the store can be prerendered or cached and show stale data between requests. `cookies()` from next/headers is async in Next 15/16 (`const jar = await cookies()`), and reading it makes the route dynamic, which is what you want here. Validate the cookie value against a pattern like /^[A-Za-z0-9_-]{1,64}$/ before using it as a map key.
