From 632c91f160dd62d3ed3061a785cf44d310a006e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ng=C3=B4=20Qu=E1=BB=91c=20=C4=90=E1=BA=A1t?= Date: Mon, 13 Apr 2026 15:10:24 +0700 Subject: [PATCH] fix: crash when creating database on PostgreSQL (macOS 26) --- TablePro/Resources/Localizable.xcstrings | 186 +++++++++++++++++- .../CreateDatabaseSheet.swift | 8 +- .../DatabaseSwitcherSheet.swift | 6 +- 3 files changed, 186 insertions(+), 14 deletions(-) diff --git a/TablePro/Resources/Localizable.xcstrings b/TablePro/Resources/Localizable.xcstrings index d8ca6729..f255b1f6 100644 --- a/TablePro/Resources/Localizable.xcstrings +++ b/TablePro/Resources/Localizable.xcstrings @@ -3085,6 +3085,9 @@ } } } + }, + "Action Failed" : { + }, "Activate" : { "localizations" : { @@ -3267,6 +3270,15 @@ } } } + }, + "Active Merges" : { + + }, + "Active Queries" : { + + }, + "Active Sessions" : { + }, "Actual" : { "localizations" : { @@ -4109,6 +4121,7 @@ } }, "ALL DATABASES" : { + "extractionState" : "stale", "localizations" : { "tr" : { "stringUnit" : { @@ -4153,6 +4166,7 @@ } }, "ALL SCHEMAS" : { + "extractionState" : "stale", "localizations" : { "tr" : { "stringUnit" : { @@ -4879,6 +4893,9 @@ } } } + }, + "Are you sure you want to cancel the running query for this session?" : { + }, "Are you sure you want to delete \"%@\"?" : { "localizations" : { @@ -4990,6 +5007,9 @@ } } } + }, + "Are you sure you want to terminate this session? Any running queries will be aborted." : { + }, "As Copy" : { "localizations" : { @@ -5780,6 +5800,9 @@ } } } + }, + "Block Size" : { + }, "Blue" : { "localizations" : { @@ -6045,6 +6068,12 @@ } } } + }, + "Bytes Received" : { + + }, + "Bytes Sent" : { + }, "CA Cert" : { "localizations" : { @@ -6089,6 +6118,12 @@ } } } + }, + "Cache Hit Ratio" : { + + }, + "Cache Size" : { + }, "Cancel" : { "localizations" : { @@ -6111,6 +6146,15 @@ } } } + }, + "Cancel Query" : { + + }, + "Cancel query for session %@" : { + + }, + "Cannot connect to Ollama at %@. Is Ollama running?" : { + }, "Cannot execute write queries: connection is read-only" : { "localizations" : { @@ -6446,6 +6490,7 @@ } }, "Character Set" : { + "extractionState" : "stale", "localizations" : { "tr" : { "stringUnit" : { @@ -8201,6 +8246,9 @@ } } } + }, + "Connected Threads" : { + }, "Connecting" : { "localizations" : { @@ -8561,6 +8609,9 @@ } } } + }, + "Connections" : { + }, "Connections:" : { "localizations" : { @@ -10182,6 +10233,12 @@ } } } + }, + "Dashboard" : { + + }, + "Dashboard Not Available" : { + }, "Data" : { "localizations" : { @@ -10492,6 +10549,9 @@ } } } + }, + "Database Size" : { + }, "Database Switch Failed" : { "localizations" : { @@ -11922,6 +11982,9 @@ } } } + }, + "Disk Usage" : { + }, "Dismiss" : { "localizations" : { @@ -12477,6 +12540,9 @@ } } } + }, + "Duration" : { + }, "Each SQLite file is a separate database.\nTo open a different database, create a new connection." : { "localizations" : { @@ -14888,7 +14954,6 @@ } }, "Failed to decompress file: %@" : { - "extractionState" : "stale", "localizations" : { "tr" : { "stringUnit" : { @@ -14999,6 +15064,16 @@ } } }, + "Failed to fetch models from %@ (HTTP %d)" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Failed to fetch models from %1$@ (HTTP %2$d)" + } + } + } + }, "Failed to fetch table structure: %@" : { "extractionState" : "stale", "localizations" : { @@ -15203,7 +15278,6 @@ } }, "Failed to load preview using encoding: %@. Try selecting a different text encoding." : { - "extractionState" : "stale", "localizations" : { "tr" : { "stringUnit" : { @@ -15226,7 +15300,6 @@ } }, "Failed to load preview: %@" : { - "extractionState" : "stale", "localizations" : { "tr" : { "stringUnit" : { @@ -16456,6 +16529,9 @@ } } } + }, + "Format Query" : { + }, "Format Query (⌥⌘F)" : { "localizations" : { @@ -19260,6 +19336,9 @@ } } } + }, + "Journal Mode" : { + }, "JSON" : { "localizations" : { @@ -19393,6 +19472,9 @@ } } } + }, + "Keep Running" : { + }, "Keep This Mac's Version" : { "localizations" : { @@ -20390,6 +20472,9 @@ } } } + }, + "Load Models" : { + }, "Load Table Template" : { "extractionState" : "stale", @@ -20436,6 +20521,9 @@ } } } + }, + "Loading dashboard..." : { + }, "Loading databases..." : { "localizations" : { @@ -20857,6 +20945,9 @@ } } } + }, + "Max Connections" : { + }, "Max schema tables: %d" : { "localizations" : { @@ -21056,6 +21147,9 @@ } } } + }, + "Memory Limit" : { + }, "METADATA" : { "localizations" : { @@ -22152,6 +22246,9 @@ } } } + }, + "Next Page" : { + }, "Next Page (⌘])" : { "localizations" : { @@ -23021,6 +23118,7 @@ } }, "No models loaded" : { + "extractionState" : "stale", "localizations" : { "tr" : { "stringUnit" : { @@ -23418,6 +23516,9 @@ } } } + }, + "No slow queries" : { + }, "No SSL encryption" : { "localizations" : { @@ -24216,6 +24317,9 @@ } } } + }, + "Off" : { + }, "Offset" : { "localizations" : { @@ -24260,6 +24364,9 @@ } } } + }, + "Ollama is running but has no models. Run \"ollama pull \" to download one." : { + }, "On Delete" : { "localizations" : { @@ -24503,6 +24610,9 @@ } } } + }, + "Open editor" : { + }, "Open File" : { "localizations" : { @@ -24949,6 +25059,12 @@ } } } + }, + "Page Count" : { + + }, + "Page Size" : { + }, "Page size must be between %@ and %@" : { "localizations" : { @@ -24977,6 +25093,9 @@ } } } + }, + "pages" : { + }, "Pagination" : { "localizations" : { @@ -25065,6 +25184,9 @@ } } } + }, + "Part Mutations" : { + }, "Partition" : { "localizations" : { @@ -25358,6 +25480,9 @@ } } } + }, + "Pause" : { + }, "pending delete" : { "localizations" : { @@ -25424,6 +25549,9 @@ } } } + }, + "PID" : { + }, "Pin Result" : { "localizations" : { @@ -26626,6 +26754,9 @@ } } } + }, + "Previous Page" : { + }, "Previous Page (⌘[)" : { "localizations" : { @@ -27787,6 +27918,7 @@ } }, "RECENT" : { + "extractionState" : "stale", "localizations" : { "tr" : { "stringUnit" : { @@ -28215,6 +28347,9 @@ } } } + }, + "Refresh Now" : { + }, "Refreshing will discard all unsaved changes." : { "localizations" : { @@ -28998,6 +29133,9 @@ } } } + }, + "Resume" : { + }, "Retention" : { "localizations" : { @@ -29551,6 +29689,9 @@ } } } + }, + "Running Threads" : { + }, "Safe Mode" : { "localizations" : { @@ -31125,6 +31266,9 @@ } } } + }, + "Server Dashboard" : { + }, "Server error (%d): %@" : { "localizations" : { @@ -31182,6 +31326,12 @@ } } } + }, + "Server Metrics" : { + + }, + "Server monitoring is not available for this database type." : { + }, "Service Account Key" : { "localizations" : { @@ -32186,6 +32336,9 @@ } } } + }, + "Slow Queries" : { + }, "Small" : { "localizations" : { @@ -33218,6 +33371,9 @@ } } } + }, + "State" : { + }, "statement" : { "localizations" : { @@ -34753,6 +34909,15 @@ } } } + }, + "Terminate" : { + + }, + "Terminate Session" : { + + }, + "Terminate session %@" : { + }, "Tertiary Text" : { "localizations" : { @@ -35820,6 +35985,9 @@ } } } + }, + "Threads" : { + }, "Tier:" : { "localizations" : { @@ -36427,6 +36595,12 @@ } } } + }, + "Total Blocks" : { + + }, + "Total Queries" : { + }, "Total Size" : { "localizations" : { @@ -37489,6 +37663,9 @@ } } } + }, + "Uptime" : { + }, "US Long (12/31/2024 11:59:59 PM)" : { "localizations" : { @@ -37643,6 +37820,9 @@ } } } + }, + "User Sessions" : { + }, "User-installed" : { "localizations" : { diff --git a/TablePro/Views/DatabaseSwitcher/CreateDatabaseSheet.swift b/TablePro/Views/DatabaseSwitcher/CreateDatabaseSheet.swift index 021b3b1e..50e42d8c 100644 --- a/TablePro/Views/DatabaseSwitcher/CreateDatabaseSheet.swift +++ b/TablePro/Views/DatabaseSwitcher/CreateDatabaseSheet.swift @@ -133,18 +133,14 @@ struct CreateDatabaseSheet: View { isCreating = true errorMessage = nil - // Capture @State values as local lets before the async boundary. - // This avoids passing strings through async closure thunks which - // have a macOS 26 (Tahoe) runtime bug with ImplicitActor argument shifting. let name = databaseName let cs = config.showOptions ? charset : "" let col: String? = config.showOptions ? collation : nil - let vm = viewModel Task { do { - try await vm.createDatabase(name: name, charset: cs, collation: col) - await vm.refreshDatabases() + try await viewModel.createDatabase(name: name, charset: cs, collation: col) + await viewModel.refreshDatabases() dismiss() } catch { errorMessage = error.localizedDescription diff --git a/TablePro/Views/DatabaseSwitcher/DatabaseSwitcherSheet.swift b/TablePro/Views/DatabaseSwitcher/DatabaseSwitcherSheet.swift index 641ed98c..977416df 100644 --- a/TablePro/Views/DatabaseSwitcher/DatabaseSwitcherSheet.swift +++ b/TablePro/Views/DatabaseSwitcher/DatabaseSwitcherSheet.swift @@ -116,11 +116,7 @@ struct DatabaseSwitcherSheet: View { .defaultFocus($focus, .search) .task { await viewModel.fetchDatabases() } .sheet(isPresented: $showCreateDialog) { - CreateDatabaseSheet(databaseType: databaseType) { name, charset, collation in - try await viewModel.createDatabase( - name: name, charset: charset, collation: collation) - await viewModel.refreshDatabases() - } + CreateDatabaseSheet(databaseType: databaseType, viewModel: viewModel) } .onExitCommand { // SwiftUI handles sheet priority automatically - no nested sheets take precedence