Fix: implement optimistic UI deletion and toast feedback (#270)#1673
Open
ayaan-7505 wants to merge 1 commit into
Open
Fix: implement optimistic UI deletion and toast feedback (#270)#1673ayaan-7505 wants to merge 1 commit into
ayaan-7505 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Description
This PR resolves the issue where clicking the delete button on a task in the Tasks page failed to remove it from the UI or database. The fix introduces optimistic UI updates to instantly remove the task on the frontend, while adding proper error handling and a Toast notification to safely fall back and notify the user if the backend request fails.
🔗 Related Issue
Closes #270
🛠 Changes Made
deleteTaskandbulkDeleteinuseTasks.jsfor an instantly responsive UI.try/catcherror handling around backend API requests, allowing the state to seamlessly revert (re-fetch) if the server fails to delete the task.Toastcomponent toTasks.jsxto provide clear, visual success/error feedback when a user deletes a task, matching the rest of the application's design system.📸 Screenshots
✅ Checklist
🚀 Notes for Reviewers
I added an inline
Toastcomponent directly intoTasks.jsxsimilar to how it is handled inProfile.jsxto ensure the user gets immediate feedback without relying on unhandled promise rejections or silent failures.