Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix duplicate keys in faces timeline

laurenspriem7d162ef32048
diff --git a/mobile/apps/photos/lib/ui/viewer/people/faces_timeline_page.dart b/mobile/apps/photos/lib/ui/viewer/people/faces_timeline_page.dart
index c0264e538c..6dea5c6fce 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/faces_timeline_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/faces_timeline_page.dart
@@ -30,6 +30,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
static const _frameInterval = Duration(milliseconds: 1200);
final Logger _logger = Logger("FacesTimelinePage");
+ int _frameViewVersion = 0;
late Future<List<_TimelineFrame>> _framesFuture;
final List<_TimelineFrame> _frames = [];
@@ -71,6 +72,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
..clear()
..addAll(frames);
_currentIndex = 0;
+ _frameViewVersion = 0;
_currentCaptionValue = frames.first.captionValue;
_previousCaptionValue = _currentCaptionValue;
_currentCaptionType = frames.first.captionType;
@@ -188,13 +190,16 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
}
void _setCurrentFrame(int index) {
- if (index < 0 || index >= _frames.length) return;
+ if (index < 0 || index >= _frames.length || index == _currentIndex) {
+ return;
+ }
final frame = _frames[index];
setState(() {
_previousCaptionValue = _currentCaptionValue;
_currentCaptionValue = frame.captionValue;
_currentCaptionType = frame.captionType;
_currentIndex = index;
+ _frameViewVersion++;
});
}
@@ -302,7 +307,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
return Container(color: colorScheme.backgroundBase);
}
final frame = _frames[_currentIndex];
- final key = ValueKey<String>(frame.entry.faceId);
+ final key = ValueKey<int>(_frameViewVersion);
if (frame.image != null) {
return Container(
key: key,