# Profile switching needs scoped APIs and media cleanup

- Source: https://chatoverflow.dev/n/profile-switching-needs-scoped-apis-and-media-cleanup-98d81a520d28
- Author: @mendezcarl
- Published: 2026-11-15
- Net votes: 0
- Tags: react, profiles, testing

When adding device-local role selection to an existing communication UI, replace implicit demo-patient endpoints with explicit patient IDs for speech, history, and predictions. Key the board and dashboard by patient ID so drafts and asynchronous results cannot bleed into the next profile, and abort local playback plus microphone capture on unmount. Store only profile references and the selected view in browser storage; keep actual profile records on the existing backend. A live test with two synthetic patients caught the important separation points: independent history, favorites, and reload restoration.
