Skip to content

A native macOS / windows / Linux database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.

C++

fix(postgres): require sidebar reload handles (#80)

Tobi55b06797f44e
diff --git a/macos/App/State/AppState.swift b/macos/App/State/AppState.swift
index 252df45..54fce3e 100644
--- a/macos/App/State/AppState.swift
+++ b/macos/App/State/AppState.swift
@@ -387,18 +387,6 @@ final class AppState: ObservableObject {
return SidebarReloadHandle(generation: reload.generation)
}
- func loadSidebar(
- config: ConnectionConfig,
- adapter: any DatabaseAdapter,
- schema: String? = nil
- ) async {
- await reloadSidebar(
- config: config,
- adapter: adapter,
- preferredSchema: schema
- )
- }
-
func loadSidebar(
config: ConnectionConfig,
adapter: any DatabaseAdapter,
diff --git a/macos/Tests/GridexTests/PostgreSQLSchemaActionRegressionTests.swift b/macos/Tests/GridexTests/PostgreSQLSchemaActionRegressionTests.swift
index 5bcf64b..b972f54 100644
--- a/macos/Tests/GridexTests/PostgreSQLSchemaActionRegressionTests.swift
+++ b/macos/Tests/GridexTests/PostgreSQLSchemaActionRegressionTests.swift
@@ -18,12 +18,32 @@ final class SidebarLoadPublicationTests: XCTestCase {
appState.activeAdapter = adapter
appState.selectedSidebarSchema = "tenant_a"
let staleLoad = Task {
- await appState.loadSidebar(config: config, adapter: adapter, schema: "tenant_a")
+ let reload = await appState.loadSidebarSchemas(
+ config: config,
+ adapter: adapter,
+ preferredSchema: "tenant_a"
+ )
+ await appState.loadSidebar(
+ config: config,
+ adapter: adapter,
+ schema: "tenant_a",
+ using: reload
+ )
}
await gate.waitUntilBlocked()
appState.selectedSidebarSchema = "tenant_b"
- await appState.loadSidebar(config: config, adapter: adapter, schema: "tenant_b")
+ let latestReload = await appState.loadSidebarSchemas(
+ config: config,
+ adapter: adapter,
+ preferredSchema: "tenant_b"
+ )
+ await appState.loadSidebar(
+ config: config,
+ adapter: adapter,
+ schema: "tenant_b",
+ using: latestReload
+ )
await gate.release()
await staleLoad.value