[mob][photos] Remove code that was for handling edge cases when magic section was depending on newly computed results every time instead of using cache
This commit is contained in:
@@ -13,7 +13,6 @@ import "package:photos/models/collection/collection_items.dart";
|
||||
import "package:photos/models/search/search_result.dart";
|
||||
import "package:photos/models/typedefs.dart";
|
||||
import "package:photos/services/collections_service.dart";
|
||||
import "package:photos/services/machine_learning/semantic_search/frameworks/ml_framework.dart";
|
||||
import "package:photos/services/search_service.dart";
|
||||
import "package:photos/ui/viewer/gallery/collection_page.dart";
|
||||
import "package:photos/ui/viewer/location/add_location_sheet.dart";
|
||||
@@ -292,8 +291,6 @@ extension SectionTypeExtensions on SectionType {
|
||||
switch (this) {
|
||||
case SectionType.location:
|
||||
return [Bus.instance.on<LocationTagUpdatedEvent>()];
|
||||
case SectionType.magic:
|
||||
return [Bus.instance.on<MLFrameworkInitializationUpdateEvent>()];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -33,28 +33,6 @@ class _MagicSectionState extends State<MagicSection> {
|
||||
super.initState();
|
||||
_magicSearchResults = widget.magicSearchResults;
|
||||
|
||||
//At times, ml framework is not initialized when the search results are
|
||||
//requested (widget.momentsSearchResults is empty) and is initialized
|
||||
//(which fires MLFrameworkInitializationUpdateEvent with
|
||||
//InitializationState.initialized) before initState of this widget is
|
||||
//called. We do listen to MLFrameworkInitializationUpdateEvent and reload
|
||||
//this widget but the event with InitializationState.initialized would have
|
||||
//already been fired in the above case.
|
||||
if (_magicSearchResults.isEmpty) {
|
||||
SectionType.magic
|
||||
.getData(
|
||||
context,
|
||||
limit: kSearchSectionLimit,
|
||||
)
|
||||
.then((value) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_magicSearchResults = value as List<GenericSearchResult>;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
final streamsToListenTo = SectionType.magic.sectionUpdateEvents();
|
||||
for (Stream<Event> stream in streamsToListenTo) {
|
||||
streamSubscriptions.add(
|
||||
@@ -84,7 +62,6 @@ class _MagicSectionState extends State<MagicSection> {
|
||||
@override
|
||||
void didUpdateWidget(covariant MagicSection oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
//widget.magicSearch is empty when doing a hot reload
|
||||
if (widget.magicSearchResults.isNotEmpty) {
|
||||
_magicSearchResults = widget.magicSearchResults;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user