From c32806d9873388c1c34af09fd69cce00d76822f8 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Fri, 26 Jun 2026 05:05:56 +0200 Subject: [PATCH] fix: show server name on all hubs with multiple servers close #1319 --- lib/screens/discover_screen.dart | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/screens/discover_screen.dart b/lib/screens/discover_screen.dart index 79b7d41a..ac1d23e3 100644 --- a/lib/screens/discover_screen.dart +++ b/lib/screens/discover_screen.dart @@ -737,13 +737,10 @@ class _DiscoverScreenState extends State return Symbols.auto_awesome_rounded; } - /// Get the set of hub titles that appear more than once (duplicates) - Set _getDuplicateHubTitles() { - final titleCounts = {}; - for (final hub in _hubs) { - titleCounts[hub.title] = (titleCounts[hub.title] ?? 0) + 1; - } - return titleCounts.entries.where((e) => e.value > 1).map((e) => e.key).toSet(); + /// Whether the loaded hubs span more than one connected server. + bool _hubsSpanMultipleServers() { + final serverIds = _hubs.where((hub) => hub.serverId != null).map((hub) => hub.serverId).toSet(); + return serverIds.length > 1; } Future _handleLogout() async { @@ -1071,7 +1068,7 @@ class _DiscoverScreenState extends State } final showServerNameOnHubs = svc.read(SettingsService.showServerNameOnHubs); - final duplicateHubTitles = _getDuplicateHubTitles(); + final hubsSpanMultipleServers = _hubsSpanMultipleServers(); final bottomPadding = MediaQuery.paddingOf(context).bottom; final theme = Theme.of(context); @@ -1129,7 +1126,7 @@ class _DiscoverScreenState extends State key: i < _orderedHubKeys.length ? _orderedHubKeys[i] : null, hub: _hubs[i], icon: _getHubIcon(_hubs[i].title), - showServerName: showServerNameOnHubs || duplicateHubTitles.contains(_hubs[i].title), + showServerName: showServerNameOnHubs || hubsSpanMultipleServers, onRefresh: _discover.updateItem, // Hub index is i + 1 if continue watching exists, otherwise i onVerticalNavigation: (isUp) => _handleVerticalNavigation(_onDeck.isNotEmpty ? i + 1 : i, isUp),