-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[mob][photos] Bug fixes #7426
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
[mob][photos] Bug fixes #7426
Conversation
Co-authored-by: Codex <[email protected]>
Code Review for PR #7426SummaryThis PR addresses a white screen issue when deleting all items from a discover category or device folder by adding null safety checks for empty collections. ✅ Positive Aspects
📝 Code Quality Observationsdevice_folder_page.dart (lines 60-62)initialFiles: deviceCollection.thumbnail != null
? [deviceCollection.thumbnail!]
: const <EnteFile>[],Analysis:
magic_result_screen.dart (line 168)initialFiles: files.isNotEmpty ? [files.first] : const [],Analysis:
🔍 Potential Issues & Recommendations1. Defensive Programming in Event Handlers (magic_result_screen.dart)Location: Lines 67-76 The _filesUpdatedEvent = Bus.instance.on<LocalPhotosUpdatedEvent>().listen((event) {
if (event.type == EventType.deletedFromDevice || ...) {
for (var updatedFile in event.updatedFiles) {
files.remove(updatedFile); // Could make files empty
}
setState(() {});
}
});Recommendation: Consider what should happen to the UI when
2. Sorting Empty Lists (magic_result_screen.dart)Location: Lines 84-89 and 100 If if (files.isNotEmpty) {
files.sort(...);
}3. Consistency CheckMinor: In 🔒 Security & Performance
🧪 Testing RecommendationsSince you tested in debug mode on Pixel, consider also testing:
📋 Minor Suggestions
✅ VerdictLGTM with minor observations The changes are:
The suggestions above are for consideration but not blockers. The fix is solid and ready to merge. Note: Consider following up with UX improvements for empty state handling as mentioned in "Potential Issues" section 1, but that can be a separate PR. |
|
@codex review |
Co-authored-by: Codex <[email protected]>
Code Review for PR #7426SummaryThis PR fixes two important bugs related to empty galleries causing white screens. The changes are well-targeted and address the root causes effectively. ✅ Strengths
📝 Specific Feedback1. device_folder_page.dart (lines 60-62)initialFiles: deviceCollection.thumbnail != null
? [deviceCollection.thumbnail!]
: const <EnteFile>[],✅ Good: Prevents crash when 2. magic_result_screen.dart (line 168)initialFiles: files.isNotEmpty ? [files.first] : const [],✅ Good: Prevents crash when files list is empty 3. person_selection_action_widgets.dart (lines 47-87)Major improvement to consistency issue! The new Small observations:
🔒 Security ConsiderationsNo security concerns identified. Changes are defensive in nature and prevent potential null pointer exceptions. ⚡ Performance Considerations
🐛 Potential IssuesNone identified - the fixes correctly address the described issues. 💡 Suggestions
✅ Final VerdictLGTM - This PR effectively fixes the reported white screen issues with appropriate defensive coding. The changes follow Dart/Flutter best practices and the repository's coding standards. The refactor of Recommendation: Approve and merge ✅ |
Co-authored-by: Codex <[email protected]>
Code ReviewSummaryThis PR fixes a crash that occurs when deleting all files from a discover category or device folder, causing a white screen. The fix properly handles null/empty cases for the ✅ Positive Aspects
💡 Code Quality Observationsdevice_folder_page.dart:60-62 magic_result_screen.dart:168
Suggestion: For consistency, consider using the explicitly typed version: initialFiles: files.isNotEmpty ? [files.first] : const <EnteFile>[],This matches the pattern in device_folder_page.dart and is more explicit about the type. 🔒 Security & Performance
🐛 Potential IssuesNone identified. The changes are minimal, focused, and correctly address the root cause. 📋 Pre-commit Checklist ReminderBefore merging, please ensure:
✨ Recommendations
Overall, this is a solid bug fix that properly handles edge cases. Great work! 🎯 |
## Description - Fix issue where deleting everything from a discover category causes white screen. ## Tests Tested in debug mode on my pixel phone.
Description
Tests
Tested in debug mode on my pixel phone.