diff --git a/app/lib/features/bangs/presentation/widgets/site_search.dart b/app/lib/features/bangs/presentation/widgets/site_search.dart index 44d921e1..ad6e8c94 100644 --- a/app/lib/features/bangs/presentation/widgets/site_search.dart +++ b/app/lib/features/bangs/presentation/widgets/site_search.dart @@ -62,9 +62,11 @@ class SiteSearch extends HookConsumerWidget { final searchFocusNode = useFocusNode(); useListenableCallback(searchTextController, () { - ref - .read(searchSuggestionsProvider().notifier) - .addQuery(searchTextController.text); + if (ref.exists(searchSuggestionsProvider())) { + ref + .read(searchSuggestionsProvider().notifier) + .addQuery(searchTextController.text); + } }); final selectedBang = ref.watch(selectedBangDataProvider(domain: domain)); diff --git a/app/lib/features/geckoview/features/browser/presentation/widgets/sheets/view_tabs.dart b/app/lib/features/geckoview/features/browser/presentation/widgets/sheets/view_tabs.dart index ced0ebc4..a59e4235 100644 --- a/app/lib/features/geckoview/features/browser/presentation/widgets/sheets/view_tabs.dart +++ b/app/lib/features/geckoview/features/browser/presentation/widgets/sheets/view_tabs.dart @@ -139,11 +139,13 @@ class _TabSheetHeader extends HookConsumerWidget { ); useListenableCallback(searchTextController, () async { - await ref - .read( - tabSearchRepositoryProvider(TabSearchPartition.preview).notifier, - ) - .addQuery(searchTextController.text); + if (ref.exists(tabSearchRepositoryProvider(TabSearchPartition.preview))) { + await ref + .read( + tabSearchRepositoryProvider(TabSearchPartition.preview).notifier, + ) + .addQuery(searchTextController.text); + } }); return Material( diff --git a/app/lib/features/geckoview/features/search/domain/providers/search_suggestions.dart b/app/lib/features/geckoview/features/search/domain/providers/search_suggestions.dart index 4eb910fa..e0eb518e 100644 --- a/app/lib/features/geckoview/features/search/domain/providers/search_suggestions.dart +++ b/app/lib/features/geckoview/features/search/domain/providers/search_suggestions.dart @@ -68,9 +68,15 @@ class SearchSuggestions extends _$SearchSuggestions { final defaultProvider = ref.watch(defaultSearchSuggestionsProvider); final resolvedProvider = suggestionsProvider ?? defaultProvider; - _addQueryBinding = ref - .watch(searchSuggestionsRepositoryProvider(resolvedProvider).notifier) - .addQuery; + _addQueryBinding = (value) { + if (ref.exists(searchSuggestionsRepositoryProvider(resolvedProvider))) { + ref + .watch( + searchSuggestionsRepositoryProvider(resolvedProvider).notifier, + ) + .addQuery(value); + } + }; return ref.watch(searchSuggestionsRepositoryProvider(resolvedProvider)); } diff --git a/app/lib/features/geckoview/features/search/domain/providers/search_suggestions.g.dart b/app/lib/features/geckoview/features/search/domain/providers/search_suggestions.g.dart index 4b35462b..c686d8df 100644 --- a/app/lib/features/geckoview/features/search/domain/providers/search_suggestions.g.dart +++ b/app/lib/features/geckoview/features/search/domain/providers/search_suggestions.g.dart @@ -98,7 +98,7 @@ final class SearchSuggestionsProvider } } -String _$searchSuggestionsHash() => r'8d1fb72cab374491a53f7a814f87af6a26356f42'; +String _$searchSuggestionsHash() => r'e181fb417f6199648a7c6d8962b1f1d5a2cf7d27'; final class SearchSuggestionsFamily extends $Family with diff --git a/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/fixed_search_suggestions.dart b/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/fixed_search_suggestions.dart index fa8a8de9..5995ba68 100644 --- a/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/fixed_search_suggestions.dart +++ b/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/fixed_search_suggestions.dart @@ -61,9 +61,11 @@ class FixedSearchTermSuggestions extends HookConsumerWidget { final searchSuggestions = ref.watch(searchSuggestionsProvider()); useListenableCallback(searchTextController, () { - ref - .read(searchSuggestionsProvider().notifier) - .addQuery(searchTextController.text); + if (ref.exists(searchSuggestionsProvider())) { + ref + .read(searchSuggestionsProvider().notifier) + .addQuery(searchTextController.text); + } }); final prioritizedSuggestions = isSuggestableText diff --git a/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/history_suggestions.dart b/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/history_suggestions.dart index 66d99e41..d12367d9 100644 --- a/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/history_suggestions.dart +++ b/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/history_suggestions.dart @@ -49,9 +49,11 @@ class HistorySuggestions extends HookConsumerWidget { final historySuggestionsAsync = ref.watch(engineHistorySuggestionsProvider); useListenableCallback(searchTextListenable, () async { - await ref - .watch(engineSuggestionsProvider.notifier) - .addQuery(searchTextListenable.value.text); + if (ref.exists(engineSuggestionsProvider)) { + await ref + .watch(engineSuggestionsProvider.notifier) + .addQuery(searchTextListenable.value.text); + } }); if (historySuggestionsAsync.hasValue && diff --git a/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/tab_search.dart b/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/tab_search.dart index 0b07d7b8..ef1f9351 100644 --- a/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/tab_search.dart +++ b/app/lib/features/geckoview/features/search/presentation/widgets/search_modules/tab_search.dart @@ -68,15 +68,19 @@ class TabSearch extends HookConsumerWidget { .value; useListenableCallback(searchTextListenable, () async { - await ref - .read(tabSearchRepositoryProvider(TabSearchPartition.search).notifier) - .addQuery( - searchTextListenable.value.text, - // ignore: avoid_redundant_argument_values dont break things - matchPrefix: _matchPrefix, - // ignore: avoid_redundant_argument_values dont break things - matchSuffix: _matchSuffix, - ); + if (ref.exists(tabSearchRepositoryProvider(TabSearchPartition.search))) { + await ref + .read( + tabSearchRepositoryProvider(TabSearchPartition.search).notifier, + ) + .addQuery( + searchTextListenable.value.text, + // ignore: avoid_redundant_argument_values dont break things + matchPrefix: _matchPrefix, + // ignore: avoid_redundant_argument_values dont break things + matchSuffix: _matchSuffix, + ); + } }); if (tabs.isEmpty) {