-
Notifications
You must be signed in to change notification settings - Fork 0
Fix headlines undo delete feature #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ding deletions - Add pendingDeletions map to track optimistic deletions - Implement lastPendingDeletionId to manage undo operations - Expand ArchivedHeadlinesStatus with initial, loading, success, and failure states - Update copyWith method to support new properties - Add extensive documentation for class and properties
…nt with id - Add 'id' parameter to UndoDeleteHeadlineRequested event - Implement props getter for UndoDeleteHeadlineRequested event
…headlines - Implement individual subscriptions for each pending deletion to allow independent undo operations. - Add optimistic UI updates for delete and restore actions. - Enhance error handling and state management for failed operations. - Introduce detailed documentation for bloc methods and functionality. - Refactor timer-based deletion to a stream-based approach for better control and testability.
- Replace lastDeletedHeadline check with pendingDeletions length comparison - Add support for undoing multiple deletions - Update SnackBar action to use the correct headline ID for undo operation
…ions - Implement PendingDeletionsService abstract class and its implementation - Add DeletionStatus enum and DeletionEvent class - Service allows requesting deletions with an undo period - Emits events when deletions are confirmed or undone - Handles multiple pending deletions and ensures proper cleanup
- Simplify and update comments for pendingDeletions and lastPendingDeletionId - Explicitly allow null for lastPendingDeletionId in copyWith method
- Rename and update existing events in archived headlines BLoC - Add new events for clearing restored headlines and handling deletion service updates - Improve documentation and code structure for better readability and maintainability
…for improved undo functionality - Replace individual deletion subscriptions with a single service for better memory management - Optimize state updates for deletion, undo, and restore operations - Externalize deletion logic to enhance testability and separation of concerns - Add support for clearing restored headlines from state
…unctionality - Add PendingDeletionsService to manage undo operations - Implement headline restoration and main list refresh - Enhance undo functionality with snackbar notification - Optimize state management and event handling
- Implement PendingDeletionsService for managing undoable deletions - Add service to App widget and bootstrap process - Provide the service through RepositoryProvider for dependency injection
- Replace print statements with dart:developer/log for better logging practices - Implement selective logging of state 'status' property when available - Add error handling and logging for accessing status property - Truncate long state string representations to 250 characters - Suppress dynamic calls lint for the file
…e undo functionality - Add generic type T to DeletionEvent to allow associating the item with the event - Implement undoDeletion with the ability to return the original item - Refactor PendingDeletionsServiceImpl to use a private _PendingDeletion class - Update deletionEvents stream to use dynamic type for better flexibility
…barHeadlineTitle - Remove pendingDeletions map from ArchivedHeadlinesState - Add snackbarHeadlineTitle to store the title of the headline for which the snackbar should be displayed - Update copyWith method to reflect changes - Update props list in ArchivedHeadlinesState to include new field
…eadlines - Specify generic type for DeletionEvent in _DeletionServiceStatusChanged event
…ement - Remove pendingDeletions map from ArchivedHeadlinesState - Simplify deletion undo logic by checking item type - Add snackbarHeadlineTitle to state for managing snackbar content - Update related emissions in bloc to reflect changes
…tions handling - Move snackbar logic out of the state and into the view - Replace direct BLoC access with PendingDeletionsService for undo action - Optimize state comparison for snackbar triggers - Simplify headline deletion snackbar display
Corrected the stream subscription in ArchivedHeadlinesBloc to properly filter and process DeletionEvent for Headline items. This ensures that when a user undoes a deletion from the snackbar within the archived headlines page, the UI immediately reflects the restored item.
Summary of ChangesHello @fulleni, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the 'undo delete' feature for archived headlines by introducing a dedicated Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively refactors the undo-delete functionality into a new, reusable PendingDeletionsService, which is a significant improvement for maintainability. The introduction of a more detailed AppBlocObserver will also be very helpful for debugging. The rest of the changes consist of minor but welcome code cleanup. I've identified a critical runtime bug related to the initialization of the new service that must be addressed, along with a few medium-severity suggestions to enhance type safety and code readability.
lib/content_management/bloc/archived_headlines/archived_headlines_bloc.dart
Show resolved
Hide resolved
- Remove unnecessary initialization of PendingDeletionsServiceImpl - This change simplifies the bootstrap process and reduces unnecessary code
- Simplify index calculation for restored headlines - Enhance readability and performance of insertion logic
Status
READY
Description
This pull request significantly improves the 'undo delete' feature for archived headlines by introducing a dedicated PendingDeletionsService. This new service centralizes the logic for managing timed deletions and their potential reversal, enhancing the robustness and maintainability of the feature. The ArchivedHeadlinesBloc and its associated UI are updated to integrate with this service, ensuring a consistent and reliable user experience for managing deleted headlines. Additionally, the BlocObserver logging has been enhanced for better debugging, and several minor code cleanups have been performed across various UI components.
Type of Change