From 119a6d23c9b89d752798bb701555ba9447f86ee4 Mon Sep 17 00:00:00 2001 From: Ngo Quoc Dat Date: Sat, 28 Mar 2026 23:15:40 +0700 Subject: [PATCH] fix: resolve sidebar CancellationError and truncate long toolbar version --- Plugins/OracleDriverPlugin/OracleConnection.swift | 2 ++ TablePro/ViewModels/SidebarViewModel.swift | 3 +++ TablePro/Views/Toolbar/ConnectionStatusView.swift | 3 +++ 3 files changed, 8 insertions(+) diff --git a/Plugins/OracleDriverPlugin/OracleConnection.swift b/Plugins/OracleDriverPlugin/OracleConnection.swift index 75a02ad7..1b3b85a3 100644 --- a/Plugins/OracleDriverPlugin/OracleConnection.swift +++ b/Plugins/OracleDriverPlugin/OracleConnection.swift @@ -195,6 +195,8 @@ final class OracleConnectionWrapper: @unchecked Sendable { throw OracleError(message: detail) } catch let error as OracleError { throw error + } catch is CancellationError { + throw CancellationError() } catch { throw OracleError(message: "Query execution failed: \(String(describing: error))") } diff --git a/TablePro/ViewModels/SidebarViewModel.swift b/TablePro/ViewModels/SidebarViewModel.swift index d48b32ad..21d7177e 100644 --- a/TablePro/ViewModels/SidebarViewModel.swift +++ b/TablePro/ViewModels/SidebarViewModel.swift @@ -170,6 +170,7 @@ final class SidebarViewModel { // MARK: - Table Loading func loadTables(force: Bool = false) { + loadTask?.cancel() guard !isLoading else { return } isLoading = true errorMessage = nil @@ -230,6 +231,8 @@ final class SidebarViewModel { } } isLoading = false + } catch is CancellationError { + isLoading = false } catch { errorMessage = error.localizedDescription isLoading = false diff --git a/TablePro/Views/Toolbar/ConnectionStatusView.swift b/TablePro/Views/Toolbar/ConnectionStatusView.swift index cb1e1b5c..44478f9b 100644 --- a/TablePro/Views/Toolbar/ConnectionStatusView.swift +++ b/TablePro/Views/Toolbar/ConnectionStatusView.swift @@ -42,6 +42,9 @@ struct ConnectionStatusView: View { Text(formattedDatabaseInfo) .font(.system(size: ThemeEngine.shared.activeTheme.typography.small, weight: .regular, design: .monospaced)) .foregroundStyle(ThemeEngine.shared.colors.toolbar.secondaryTextSwiftUI) + .lineLimit(1) + .truncationMode(.middle) + .frame(maxWidth: 280) .accessibilityLabel( String(localized: "Database type: \(formattedDatabaseInfo)") )