File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -158,13 +158,11 @@ final class SidebarViewModel {
158158 NSLog ( " [SidebarVM] onAppear: tables not empty (%d), skipping " , tables. count)
159159 return
160160 }
161- Task { @MainActor in
162- if DatabaseManager . shared. driver ( for: connectionId) != nil {
163- NSLog ( " [SidebarVM] onAppear: driver found, loading tables " )
164- loadTables ( )
165- } else {
166- NSLog ( " [SidebarVM] onAppear: driver is nil for %@ " , connectionId. uuidString)
167- }
161+ if DatabaseManager . shared. driver ( for: connectionId) != nil {
162+ NSLog ( " [SidebarVM] onAppear: driver found, loading tables " )
163+ loadTables ( )
164+ } else {
165+ NSLog ( " [SidebarVM] onAppear: driver is nil for %@ " , connectionId. uuidString)
168166 }
169167 }
170168
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ struct SidebarView: View {
149149 private var tablesContent : some View {
150150 if let error = viewModel. errorMessage {
151151 errorState ( message: error)
152- } else if tables. isEmpty && viewModel . isLoading {
152+ } else if tables. isEmpty && hasActiveConnection {
153153 loadingState
154154 } else if tables. isEmpty {
155155 emptyState
@@ -158,6 +158,10 @@ struct SidebarView: View {
158158 }
159159 }
160160
161+ private var hasActiveConnection : Bool {
162+ viewModel. isLoading || DatabaseManager . shared. driver ( for: connectionId) != nil
163+ }
164+
161165 private var loadingState : some View {
162166 ProgressView ( )
163167 . frame ( maxWidth: . infinity, maxHeight: . infinity)
You can’t perform that action at this time.
0 commit comments