fix(#172): guard mounted before snackbar in channel Block sender

Gemini review (HIGH): add !mounted guard after the async block/blockName before
showing the snackbar. Captured messenger already made it safe, but this hardens
against showing on a popped route. (MEDIUM 'stale itemBuilder read' assessed as a
false positive: context.read in itemBuilder returns live state at menu-open.)

Epic A #165 / A5 #172.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pull/209/head
Strycher 1 week ago
parent ff255d366f
commit bfc7618d51

@ -519,9 +519,11 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
for (final key in keys) { for (final key in keys) {
await blockService.block(key); await blockService.block(key);
} }
if (!mounted) return;
messenger.showSnackBar(SnackBar(content: Text(l10n.block_blocked(name)))); messenger.showSnackBar(SnackBar(content: Text(l10n.block_blocked(name))));
} else { } else {
await blockService.blockName(name); await blockService.blockName(name);
if (!mounted) return;
messenger.showSnackBar( messenger.showSnackBar(
SnackBar(content: Text(l10n.block_blockedNameOnly(name))), SnackBar(content: Text(l10n.block_blockedNameOnly(name))),
); );

Loading…
Cancel
Save

Powered by TurnKey Linux.