Skip to content

Commit 3c4691a

Browse files
committed
fix: moveGroups bounds check and remove dead hoveredConnectionId state
1 parent 07ce6d1 commit 3c4691a

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

TablePro/Views/Connection/WelcomeWindowView.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ struct WelcomeWindowView: View {
3131
@State private var connectionToEdit: DatabaseConnection?
3232
@State private var connectionsToDelete: [DatabaseConnection] = []
3333
@State private var showDeleteConfirmation = false
34-
@State private var hoveredConnectionId: UUID?
3534
@State private var selectedConnectionIds: Set<UUID> = []
3635
@FocusState private var focus: FocusField?
3736
@State private var showOnboarding = !AppSettingsStorage.shared.hasCompletedOnboarding()
@@ -946,13 +945,13 @@ struct WelcomeWindowView: View {
946945

947946
private func moveGroups(from source: IndexSet, to destination: Int) {
948947
let active = activeGroups
949-
guard source.allSatisfy({ $0 < active.count }),
950-
destination <= active.count else { return }
951-
952948
let activeGroupIndices = active.compactMap { activeGroup in
953949
groups.firstIndex(where: { $0.id == activeGroup.id })
954950
}
955951

952+
guard source.allSatisfy({ $0 < activeGroupIndices.count }),
953+
destination <= activeGroupIndices.count else { return }
954+
956955
let globalSource = IndexSet(source.map { activeGroupIndices[$0] })
957956
let globalDestination: Int
958957
if destination < activeGroupIndices.count {

0 commit comments

Comments
 (0)