diff --git a/app/lib/features/geckoview/features/browser/presentation/screens/browser.dart b/app/lib/features/geckoview/features/browser/presentation/screens/browser.dart index 18b729a0..a90cd517 100644 --- a/app/lib/features/geckoview/features/browser/presentation/screens/browser.dart +++ b/app/lib/features/geckoview/features/browser/presentation/screens/browser.dart @@ -598,7 +598,7 @@ class BrowserScreen extends HookConsumerWidget { if (tabId == null) { return const SizedBox.shrink(); } - return FindInPageWidget(tabId: tabId); + return FindInPageWidget(key: ValueKey(tabId), tabId: tabId); }, ), ), diff --git a/app/lib/features/geckoview/features/find_in_page/presentation/widgets/find_in_page.dart b/app/lib/features/geckoview/features/find_in_page/presentation/widgets/find_in_page.dart index 2dc59fe6..dd62e5a4 100644 --- a/app/lib/features/geckoview/features/find_in_page/presentation/widgets/find_in_page.dart +++ b/app/lib/features/geckoview/features/find_in_page/presentation/widgets/find_in_page.dart @@ -31,7 +31,11 @@ class FindInPageWidget extends HookConsumerWidget { /// The height of the find-in-page widget. static const findInPageHeight = 56.0; - const FindInPageWidget({required this.tabId, this.padding = EdgeInsets.zero}); + const FindInPageWidget({ + required this.tabId, + this.padding = EdgeInsets.zero, + super.key, + }); @override Widget build(BuildContext context, WidgetRef ref) { @@ -45,19 +49,6 @@ class FindInPageWidget extends HookConsumerWidget { text: searchResult?.lastSearchText ?? findInPageState.lastSearchText, ); - // Update controller text when search result changes from external sources - // (e.g., when navigating between matches) - useEffect(() { - final currentText = textController.text; - final newText = - searchResult?.lastSearchText ?? findInPageState.lastSearchText ?? ''; - - if (currentText != newText) { - textController.text = newText; - } - return null; - }, [searchResult?.lastSearchText, findInPageState.lastSearchText]); - // Create debouncer with automatic disposal final debouncer = useDebouncer(const Duration(milliseconds: 300));