From 414c1a9f8ae515ce7b10869ad4fb91285ca18ead Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 22 Apr 2026 16:29:43 +0000 Subject: [PATCH] fix: add missing mounted check in chat_page_lifecycle Added `if (!mounted) return;` before reading `ProjectProvider` from context in `_handleServerScopeChange` to fix `use_build_context_synchronously` analyzer warning and prevent potential runtime exceptions when the widget unmounts during the previous async operation. Co-authored-by: insign <1113045+insign@users.noreply.github.com> --- lib/presentation/pages/chat_page/chat_page_lifecycle.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/presentation/pages/chat_page/chat_page_lifecycle.dart b/lib/presentation/pages/chat_page/chat_page_lifecycle.dart index 267b9b8a..8149f457 100644 --- a/lib/presentation/pages/chat_page/chat_page_lifecycle.dart +++ b/lib/presentation/pages/chat_page/chat_page_lifecycle.dart @@ -464,6 +464,7 @@ extension _ChatPageLifecycle on _ChatPageState { ); } } + if (!mounted) return; final projectProvider = context.read(); await projectProvider.onServerScopeChanged(); await _chatProvider?.onServerScopeChanged();