debugfest/mern-book-tracker

Feature Request: Edit Book UI with Optimistic Update

开放

#4 创建于 2025年10月11日

 (1 条评论) (0 个反应) (1 位负责人)TypeScript (5 个派生)auto 404
enhancementgood first issuehacktoberfest

仓库指标

星标
 (0 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.tsx or modal-based editor.
  • Pre-fill form with existing data.
  • PUT /api/books/:id for 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

  1. Open edit form for a book.
  2. Modify title or author → save changes.
  3. Observe instant update and confirmation after server response.

贡献者指南