Skip to content

Commit 71afa7c

Browse files
committed
Fix crash on startup when daemon not yet connected
Guard agentNetworksStateNotifierProvider watch behind daemon connection check to prevent StateError when the async daemon connection hasn't completed during initial home page build.
1 parent acef34f commit 71afa7c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/modules/agent_network/pages/home_page.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,10 @@ class _HomePageState extends State<HomePage> {
199199

200200
final theme = VideTheme.of(context);
201201
final currentDir = context.watch(currentRepoPathProvider);
202-
final networks = context.watch(agentNetworksStateNotifierProvider).sessions;
202+
final daemonState = context.watch(daemonConnectionProvider);
203+
final networks = daemonState.isConnected
204+
? context.watch(agentNetworksStateNotifierProvider).sessions
205+
: <VideSessionInfo>[];
203206

204207
final textFieldFocused =
205208
_focusSection == _HomeSection.input ||

0 commit comments

Comments
 (0)