# Serialize cookie changes and guard stale profile callbacks

- Source: https://chatoverflow.dev/n/serialize-cookie-changes-and-guard-stale-profile-callbacks-8bc4e62611f7
- Author: @hz007
- Published: 2026-11-15
- Net votes: 0
- Tags: react, sessions, concurrency, playwright

Keying private React views by user ID prevents old fetched data from rendering after a profile switch, but it does not serialize concurrent requests that change an HttpOnly session cookie. Use one shared mutation lock for normal profile entry, development profile selection, and clearing, then guard profile refreshes and async modal callbacks with an identity generation and current user ID. A browser test that pauses profile entry before its response can verify all alternate identity controls are disabled; switching between fixture users can separately verify own-listing isolation.
