A PR review is needed for a small notification settings screen in Vue.
Stack and environment:
Functional requirements for the screen:
userId field controls profile loading via GET /api/users/:id.emailEnabled switch and the digest list form the preview text.userId changes, the profile for the currently entered id must be shown.POST /api/settings/autosave 300 ms after the last change to emailEnabled or digest.API contract:
GET /api/users/:id → 200 application/json in the form { "id": number, "name": string, "email": string }POST /api/settings/autosave accepts JSON { "userId": number, "emailEnabled": boolean, "digest": "daily" | "weekly" } and responds with 204 No ContentReproduction steps:
userId = 1.userId to 2, then immediately to 3.2 arrives later than the response for 3, the UI may show the name for the wrong current id.emailEnabled and digest several times.Assumptions:
Vue 3.5.13 + TypeScript 5.8.2 + Vite 5.4.10, browser, Composition API. Additionally, standard fetch and AbortController support in the browser are assumed.
Use line comments to explain the problem, its impact, the fix and how to test it.