There is a small note panel in React 19 + TypeScript 5.8. The application runs in the browser, and the root render is wrapped in React StrictMode in development; the check must also pass in the production build, where effects are not double-invoked. The dependencies and API in the task are fixed: react 19.0.0, react-dom 19.0.0, typescript 5.8.x. The component receives a list of notes, allows quickly switching the active note, and saves the comment text for the current note.
API contract:
fetchNote(id: string): Promise<Note> returns the full note data.saveNote(input: { id: string; comment: string }): Promise<Note> saves the comment and returns the up-to-date note from the server.Functional requirements:
How to reproduce the observed issues in the current PR:
n-1, then quickly switch to n-2. While the new load is in progress, the selected note title has already changed, but the old details and old comment are still visible on the right.first, click Save, immediately change the text to second, and click Save again. If the first response returns later than the second, the screen may end up showing the non-latest comment.Assumptions:
saveNote does not automatically cancel previous saves;You need to review the PR and find independent defects in the changes. The fix must keep TypeScript compiling and work correctly in both dev and prod modes.
Browser, React 19.0.0, ReactDOM 19.0.0, TypeScript 5.8.x, development with StrictMode and production build. No extra setup is required: the API methods in the files below simulate the network via Promise and setTimeout.
Use line comments to explain the problem, its impact, the fix and how to test it.