Skip to content

armgit / ente

Public Imported from GitHub
0

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

remove using context only after init of widget is complete, can use context during init

ashilknacbf3baa8085
diff --git a/lib/states/all_sections_examples_state.dart b/lib/states/all_sections_examples_state.dart
index 71598e8c0a..0e2512abe1 100644
--- a/lib/states/all_sections_examples_state.dart
+++ b/lib/states/all_sections_examples_state.dart
@@ -1,7 +1,6 @@
import "dart:async";
import "package:flutter/material.dart";
-import "package:flutter/scheduler.dart";
import "package:logging/logging.dart";
import "package:photos/core/constants.dart";
import "package:photos/core/event_bus.dart";
@@ -37,13 +36,11 @@ class _AllSectionsExamplesProviderState
@override
void initState() {
super.initState();
- SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
- //add all common events for all search sections to reload to here.
- _filesUpdatedEvent = Bus.instance.on<FilesUpdatedEvent>().listen((event) {
- reloadAllSections();
- });
+ //add all common events for all search sections to reload to here.
+ _filesUpdatedEvent = Bus.instance.on<FilesUpdatedEvent>().listen((event) {
reloadAllSections();
});
+ reloadAllSections();
}
void reloadAllSections() {
diff --git a/lib/ui/viewer/search/result/search_section_all_page.dart b/lib/ui/viewer/search/result/search_section_all_page.dart
index b12f6edf35..9a003b21f8 100644
--- a/lib/ui/viewer/search/result/search_section_all_page.dart
+++ b/lib/ui/viewer/search/result/search_section_all_page.dart
@@ -30,6 +30,8 @@ class _SearchSectionAllPageState extends State<SearchSectionAllPage> {
@override
void initState() {
super.initState();
+ sectionData = widget.sectionType.getData(context);
+
final streamsToListenTo = widget.sectionType.viewAllUpdateEvents();
for (Stream<Event> stream in streamsToListenTo) {
streamSubscriptions.add(
@@ -42,12 +44,6 @@ class _SearchSectionAllPageState extends State<SearchSectionAllPage> {
}
}
- @override
- void didChangeDependencies() {
- super.didChangeDependencies();
- sectionData = widget.sectionType.getData(context);
- }
-
@override
void dispose() {
for (var subscriptions in streamSubscriptions) {