π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix: search results from previous query coming up due to race condition
ashilknf267bb3d0820
diff --git a/lib/ui/viewer/search/search_widget.dart b/lib/ui/viewer/search/search_widget.dartindex 4bb08cf13e..04192f4b2e 100644--- a/lib/ui/viewer/search/search_widget.dart+++ b/lib/ui/viewer/search/search_widget.dart@@ -75,13 +75,22 @@ class SearchWidgetState extends State<SearchWidget> {}Future<void> textControllerListener() async {+ //query in local varialbefinal value = textController.text;isSearchQueryEmpty = value.isEmpty;+ //latest query in global variablequery = textController.text;final List<SearchResult> allResults =await getSearchResultsForQuery(context, value);- if (mounted) {+ /*checking if query == value to make sure that the results are from the current query+ and not from the previous query (race condition).*/+ //checking if query == value to make sure that the latest query's result+ //(allResults) is passed to updateResult. Due to race condition, the previous+ //query's allResults could be passed to updateResult after the lastest query's+ //allResults is passed.++ if (mounted && query == value) {final inheritedSearchResults = InheritedSearchResults.of(context);inheritedSearchResults.updateResults(allResults);}