Add loading state, error handling, and retry mechanism for memory operations#3503
Add loading state, error handling, and retry mechanism for memory operations#3503
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a loading state, error handling, and a retry mechanism for memory operations, which significantly improves the user experience. The implementation is well-executed across both desktop and mobile dialogs, and the provider methods have been appropriately updated to return a success status. My review focuses on a couple of issues related to analytics tracking: one is a bug causing premature event firing, and the other is a missing event in one of the widgets. The suggested fixes will ensure accurate and consistent analytics.
| try { | ||
| success = await widget.provider.editMemory( | ||
| widget.memory, | ||
| contentController.text, | ||
| widget.memory.category, | ||
| ); | ||
| } catch (e) { | ||
| success = false; | ||
| debugPrint('Error saving memory: $e'); | ||
| } |
There was a problem hiding this comment.
The _handleSave method is missing an analytics call to track when a memory is successfully edited. This is inconsistent with other similar dialogs in the app (e.g., memory_dialog.dart) and means this important user action will not be tracked. Please add a call to MixpanelManager().memoriesPageEditedMemory() when the edit operation is successful.
| try { | |
| success = await widget.provider.editMemory( | |
| widget.memory, | |
| contentController.text, | |
| widget.memory.category, | |
| ); | |
| } catch (e) { | |
| success = false; | |
| debugPrint('Error saving memory: $e'); | |
| } | |
| try { | |
| success = await widget.provider.editMemory( | |
| widget.memory, | |
| contentController.text, | |
| widget.memory.category, | |
| ); | |
| if (success) { | |
| MixpanelManager().memoriesPageEditedMemory(); | |
| } | |
| } catch (e) { | |
| success = false; | |
| debugPrint('Error saving memory: $e'); | |
| } |
loading state, error handling, and retry mechanism for memory operations
deploy
#3498