🐛 Fix bugs
This commit is contained in:
@@ -94,11 +94,20 @@ class SearchMessagesScreen extends HookConsumerWidget {
|
|||||||
return () {
|
return () {
|
||||||
debounceTimer.value?.cancel();
|
debounceTimer.value?.cancel();
|
||||||
messagesNotifier.clearSearch();
|
messagesNotifier.clearSearch();
|
||||||
// Clear flashing messages when leaving search
|
// Note: Don't access ref here as widget may be disposed
|
||||||
ref.read(flashingMessagesProvider.notifier).state = {};
|
// Flashing messages will be cleared by the next screen or jump operation
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// Clear flashing messages when screen initializes (safer than in dispose)
|
||||||
|
useEffect(() {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
// Clear flashing messages when entering search screen
|
||||||
|
ref.read(flashingMessagesProvider.notifier).state = {};
|
||||||
|
});
|
||||||
|
return null;
|
||||||
|
}, []);
|
||||||
|
|
||||||
return AppScaffold(
|
return AppScaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('searchMessages').tr(),
|
title: const Text('searchMessages').tr(),
|
||||||
|
Reference in New Issue
Block a user