Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove redundant boundary reporting calls from initState

ashilknd8f055378542
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
index 14fbefacca..ad08b9e57f 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
@@ -762,10 +762,6 @@ class _PinnedGroupHeaderState extends State<PinnedGroupHeader>
_scrollControllerListenerForZeroScrollNotifier,
);
widget.headerHeightNotifier.addListener(_headerHeightNotifierListener);
-
- WidgetsBinding.instance.addPostFrameCallback((_) {
- reportBoundary(BoundaryPosition.top);
- });
}
@override
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart
index 895e3bea43..29e3d7ace2 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/add_photos_sheet.dart
@@ -341,14 +341,6 @@ class _AppBarWithBoundary extends StatefulWidget {
class _AppBarWithBoundaryState extends State<_AppBarWithBoundary>
with BoundaryReporter {
- @override
- void initState() {
- super.initState();
- WidgetsBinding.instance.addPostFrameCallback((_) {
- reportBoundary(BoundaryPosition.top);
- });
- }
-
@override
Widget build(BuildContext context) {
return boundaryWidget(
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart
index 6c00e212a9..2408c0eba8 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/large_files_page.dart
@@ -113,14 +113,6 @@ class _LargeFilesAppBar extends StatefulWidget {
class _LargeFilesAppBarState extends State<_LargeFilesAppBar>
with BoundaryReporter {
- @override
- void initState() {
- super.initState();
- WidgetsBinding.instance.addPostFrameCallback((_) {
- reportBoundary(BoundaryPosition.top);
- });
- }
-
@override
Widget build(BuildContext context) {
return boundaryWidget(
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/state/boundary_reporter_mixin.dart b/mobile/apps/photos/lib/ui/viewer/gallery/state/boundary_reporter_mixin.dart
index 5fd9999126..76180d2d2b 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/state/boundary_reporter_mixin.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/state/boundary_reporter_mixin.dart
@@ -12,7 +12,9 @@ mixin BoundaryReporter<T extends StatefulWidget> on State<T> {
Timer? _boundaryUpdateTimer;
/// Report this widget's boundary to the provider
- /// Call this in initState, didUpdateWidget, and when size might change
+ /// Call this when the widget is first built and when its size or position changes.
+ /// Note: If using boundaryWidget() wrapper, boundaries are reported automatically
+ /// after each build - manual calls are only needed for dynamic updates (e.g., visibility changes).
void reportBoundary(BoundaryPosition position) {
// Debounce updates to avoid excessive recalculation
_boundaryUpdateTimer?.cancel();
diff --git a/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart b/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart
index 3476e4b098..f456e283fc 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/cluster_page.dart
@@ -234,15 +234,6 @@ class _AppBarWithBoundary extends StatefulWidget {
class _AppBarWithBoundaryState extends State<_AppBarWithBoundary>
with BoundaryReporter {
- @override
- void initState() {
- super.initState();
- // Report boundary after the first frame
- WidgetsBinding.instance.addPostFrameCallback((_) {
- reportBoundary(BoundaryPosition.top);
- });
- }
-
@override
Widget build(BuildContext context) {
return boundaryWidget(
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
index 6027a9b164..2521e6f7b9 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/contact_result_page.dart
@@ -272,15 +272,6 @@ class _AppBarWithBoundary extends StatefulWidget {
class _AppBarWithBoundaryState extends State<_AppBarWithBoundary>
with BoundaryReporter {
- @override
- void initState() {
- super.initState();
- // Report boundary after the first frame
- WidgetsBinding.instance.addPostFrameCallback((_) {
- reportBoundary(BoundaryPosition.top);
- });
- }
-
@override
Widget build(BuildContext context) {
return boundaryWidget(
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart b/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart
index 9c79e46337..fae5ed5032 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/magic_result_screen.dart
@@ -244,15 +244,6 @@ class _AppBarWithBoundary extends StatefulWidget {
class _AppBarWithBoundaryState extends State<_AppBarWithBoundary>
with BoundaryReporter {
- @override
- void initState() {
- super.initState();
- // Report boundary after the first frame
- WidgetsBinding.instance.addPostFrameCallback((_) {
- reportBoundary(BoundaryPosition.top);
- });
- }
-
@override
Widget build(BuildContext context) {
return boundaryWidget(
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dart
index 2a6630b9be..187567a71f 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/search_result_page.dart
@@ -174,15 +174,6 @@ class _AppBarWithBoundary extends StatefulWidget {
class _AppBarWithBoundaryState extends State<_AppBarWithBoundary>
with BoundaryReporter {
- @override
- void initState() {
- super.initState();
- // Report boundary after the first frame
- WidgetsBinding.instance.addPostFrameCallback((_) {
- reportBoundary(BoundaryPosition.top);
- });
- }
-
@override
Widget build(BuildContext context) {
return boundaryWidget(