π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Avoid duplicate search when keyboard dismisses
ashilknff935450897c
diff --git a/mobile/apps/photos/changes/search-query-dedupe.md b/mobile/apps/photos/changes/search-query-dedupe.mdnew file mode 100644index 0000000000..0fe4ddce2a--- /dev/null+++ b/mobile/apps/photos/changes/search-query-dedupe.md@@ -0,0 +1 @@+- Avoid re-running Photos search when dismissing the keyboard without changing the query.diff --git a/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/search_widget.dartindex c9cf208de5..fac4016884 100644--- a/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart@@ -40,6 +40,7 @@ class SearchWidgetState extends State<SearchWidget> {StreamSubscription<TabChangedEvent>? _tabChangedEvent;StreamSubscription<TabDoubleTapEvent>? _tabDoubleTapEvent;TextEditingController textController = TextEditingController();+ String? _lastRequestedQuery;late final StreamSubscription<ClearAndUnfocusSearchBar>_clearAndUnfocusSearchBar;late final Logger _logger = Logger("SearchWidgetState");@@ -126,10 +127,15 @@ class SearchWidgetState extends State<SearchWidget> {Future<void> textControllerListener() async {_syncSearchBackNotifier();+ final nextQuery = textController.text.trim();+ if (nextQuery == _lastRequestedQuery) {+ return;+ }+ _lastRequestedQuery = nextQuery;isLoading.value = true;_debouncer.run(() async {if (mounted) {- query = textController.text.trim();+ query = nextQuery;IndexOfStackNotifier().isSearchQueryEmpty = query.isEmpty;searchResultsStreamNotifier.value = _getSearchResultsStream(context,