debugfest/mern-book-tracker
Feature Request: Edit Book UI with Optimistic Update
Aperta
#4 aperta il 11 ott 2025
enhancementgood first issuehacktoberfest
Metriche repository
- Star
- (0 stelle)
- Metriche merge PR
- (Metriche PR in attesa)
Descrizione
Allow users to edit existing book details using a modal or dedicated edit page. The UI should optimistically update book details while waiting for the server response.
🎯 Proposed Solution
- Add Edit button on each book card.
- Create
EditBook.tsxor modal-based editor. - Pre-fill form with existing data.
- PUT
/api/books/:idfor saving updates. - Implement optimistic updates and rollback if the request fails.
✅ Expected Behavior
- User can edit book fields and save.
- UI updates immediately on save click.
- Changes persist after backend confirmation.
💻 Technical Notes
- Maintain a local copy of book data for rollback if needed.
- Use React Query or manual state updates for optimistic UI.
🧪 Test Steps
- Open edit form for a book.
- Modify title or author → save changes.
- Observe instant update and confirmation after server response.