Skip to content

armgit / ente

Public Imported from GitHub
0

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

Reload only location search section on changes related to loc tag

ashilkn09a78038ebae
diff --git a/lib/models/search/search_types.dart b/lib/models/search/search_types.dart
index 79137bad23..118c562157 100644
--- a/lib/models/search/search_types.dart
+++ b/lib/models/search/search_types.dart
@@ -262,9 +262,7 @@ extension SectionTypeExtensions on SectionType {
}
}
- //Use this only for the 'view all' screens as all search section examples get
- //reloaded on filesUpdatedEvent
- List<Stream<Event>> updateEvents() {
+ List<Stream<Event>> viewAllUpdateEvents() {
switch (this) {
case SectionType.location:
return [Bus.instance.on<LocationTagUpdatedEvent>()];
@@ -274,4 +272,15 @@ extension SectionTypeExtensions on SectionType {
return [];
}
}
+
+ ///Events to listen to for different search sections, different from common
+ ///events listened to in AllSectionsExampleState.
+ List<Stream<Event>> sectionUpdateEvents() {
+ switch (this) {
+ case SectionType.location:
+ return [Bus.instance.on<LocationTagUpdatedEvent>()];
+ default:
+ return [];
+ }
+ }
}
diff --git a/lib/states/all_sections_examples_state.dart b/lib/states/all_sections_examples_state.dart
index 1152ea17d1..84ac1eef4e 100644
--- a/lib/states/all_sections_examples_state.dart
+++ b/lib/states/all_sections_examples_state.dart
@@ -34,6 +34,7 @@ class _AllSectionsExamplesProviderState
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) {
_debouncer.run(() async {
setState(() {
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 6df8a8a245..90abafcf87 100644
--- a/lib/ui/viewer/search/result/search_section_all_page.dart
+++ b/lib/ui/viewer/search/result/search_section_all_page.dart
@@ -30,7 +30,7 @@ class _SearchSectionAllPageState extends State<SearchSectionAllPage> {
@override
void initState() {
super.initState();
- final streamsToListenTo = widget.sectionType.updateEvents();
+ final streamsToListenTo = widget.sectionType.viewAllUpdateEvents();
for (Stream<Event> stream in streamsToListenTo) {
streamSubscriptions.add(
stream.listen((event) async {
diff --git a/lib/ui/viewer/search/search_section.dart b/lib/ui/viewer/search/search_section.dart
index 391ed20044..a34ab0ffd7 100644
--- a/lib/ui/viewer/search/search_section.dart
+++ b/lib/ui/viewer/search/search_section.dart
@@ -44,7 +44,7 @@ class _SearchSectionState extends State<SearchSection> {
super.initState();
_examples = widget.examples;
- final streamsToListenTo = widget.sectionType.updateEvents();
+ final streamsToListenTo = widget.sectionType.sectionUpdateEvents();
for (Stream<Event> stream in streamsToListenTo) {
streamSubscriptions.add(
stream.listen((event) async {