From 169e0905c5a5856884fa12b6f42871bf5851db7f Mon Sep 17 00:00:00 2001 From: chaos-zhu Date: Wed, 20 May 2026 21:59:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20server=E9=A1=B5=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/lib/features/servers/servers_tab.dart | 5 +++++ mobile/lib/state/host_list_notifier.dart | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mobile/lib/features/servers/servers_tab.dart b/mobile/lib/features/servers/servers_tab.dart index 5097468..dac3851 100644 --- a/mobile/lib/features/servers/servers_tab.dart +++ b/mobile/lib/features/servers/servers_tab.dart @@ -182,6 +182,11 @@ class _ServersTabState extends ConsumerState { ], ), body: RefreshIndicator( + color: Theme.of(context).colorScheme.primary, + backgroundColor: Theme.of(context).colorScheme.surface, + displacement: 30, + edgeOffset: 6, + strokeWidth: 2, onRefresh: _refresh, child: AnimatedBuilder( animation: manager, diff --git a/mobile/lib/state/host_list_notifier.dart b/mobile/lib/state/host_list_notifier.dart index 86d2a0b..36bc2cb 100644 --- a/mobile/lib/state/host_list_notifier.dart +++ b/mobile/lib/state/host_list_notifier.dart @@ -21,7 +21,10 @@ class HostListNotifier extends AsyncNotifier> { } Future refresh() async { - state = const AsyncLoading(); + final previous = state.valueOrNull; + if (previous == null) { + state = const AsyncLoading(); + } state = await AsyncValue.guard(() async { try { return await ref.read(serverRepositoryProvider).fetchHosts(); @@ -30,6 +33,9 @@ class HostListNotifier extends AsyncNotifier> { rethrow; } }); + if (state.hasError && previous != null) { + state = AsyncData(previous); + } } }