From 8513da9c15219e17100d4f9ee8e0c0995988c6ea Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Fri, 17 Mar 2023 19:54:16 +0100 Subject: [PATCH] fixed search when using the query bar --- CHANGELOG.md | 1 + lib/widgets/search/search_delegate.dart | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f97ffd6a..a189cbc36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. ### Fixed - Viewer: playing video from app content provider +- Search: using the query bar yields a black screen ## [v1.8.3] - 2023-03-13 diff --git a/lib/widgets/search/search_delegate.dart b/lib/widgets/search/search_delegate.dart index 7dba129a5..d982aeeaf 100644 --- a/lib/widgets/search/search_delegate.dart +++ b/lib/widgets/search/search_delegate.dart @@ -272,14 +272,20 @@ class CollectionSearchDelegate extends AvesSearchDelegate with FeedbackMixin, Va ); } + var _selectingFromQuery = false; + @override Widget buildResults(BuildContext context) { - WidgetsBinding.instance.addPostFrameCallback((_) { - // `buildResults` is called in the build phase, - // so we post the call that will filter the collection - // and possibly trigger a rebuild here - _select(context, _buildQueryFilter(true)); - }); + // guard against multiple build calls + if (!_selectingFromQuery) { + _selectingFromQuery = true; + WidgetsBinding.instance.addPostFrameCallback((_) { + // `buildResults` is called in the build phase, + // so we post the call that will filter the collection + // and possibly trigger a rebuild here + _select(context, _buildQueryFilter(true)); + }); + } return const SizedBox(); }