Skip to content

Commit f231b33

Browse files
committed
fix: address review — remove orphaned xcstring, atomic icon preservation, clarify columns
1 parent a7083cc commit f231b33

4 files changed

Lines changed: 28 additions & 23 deletions

File tree

TablePro/Core/Plugins/PluginManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ final class PluginManager {
265265
from: driverType,
266266
isDownloadable: driverType.isDownloadable
267267
)
268-
PluginMetadataRegistry.shared.register(snapshot: snapshot, forTypeId: typeId)
268+
PluginMetadataRegistry.shared.register(snapshot: snapshot, forTypeId: typeId, preserveIcon: true)
269269
for additionalId in driverType.additionalDatabaseTypeIds {
270-
PluginMetadataRegistry.shared.register(snapshot: snapshot, forTypeId: additionalId)
270+
PluginMetadataRegistry.shared.register(snapshot: snapshot, forTypeId: additionalId, preserveIcon: true)
271271
PluginMetadataRegistry.shared.registerTypeAlias(additionalId, primaryTypeId: typeId)
272272
}
273273

TablePro/Core/Plugins/PluginMetadataRegistry.swift

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,22 @@ struct PluginMetadataSnapshot: Sendable {
117117
additionalConnectionFields: []
118118
)
119119
}
120+
121+
func withIconName(_ newIconName: String) -> PluginMetadataSnapshot {
122+
PluginMetadataSnapshot(
123+
displayName: displayName, iconName: newIconName, defaultPort: defaultPort,
124+
requiresAuthentication: requiresAuthentication, supportsForeignKeys: supportsForeignKeys,
125+
supportsSchemaEditing: supportsSchemaEditing, isDownloadable: isDownloadable,
126+
primaryUrlScheme: primaryUrlScheme, parameterStyle: parameterStyle,
127+
navigationModel: navigationModel, explainVariants: explainVariants,
128+
pathFieldRole: pathFieldRole, supportsHealthMonitor: supportsHealthMonitor,
129+
urlSchemes: urlSchemes, postConnectActions: postConnectActions,
130+
brandColorHex: brandColorHex, queryLanguageName: queryLanguageName,
131+
editorLanguage: editorLanguage, connectionMode: connectionMode,
132+
supportsDatabaseSwitching: supportsDatabaseSwitching,
133+
capabilities: capabilities, schema: schema, editor: editor, connection: connection
134+
)
135+
}
120136
}
121137

122138
final class PluginMetadataRegistry: @unchecked Sendable {
@@ -513,11 +529,15 @@ final class PluginMetadataRegistry: @unchecked Sendable {
513529
reverseTypeIndex["ScyllaDB"] = "Cassandra"
514530
}
515531

516-
func register(snapshot: PluginMetadataSnapshot, forTypeId typeId: String) {
532+
func register(snapshot: PluginMetadataSnapshot, forTypeId typeId: String, preserveIcon: Bool = false) {
517533
lock.lock()
518534
defer { lock.unlock() }
519-
snapshots[typeId] = snapshot
520-
for scheme in snapshot.urlSchemes {
535+
var resolved = snapshot
536+
if preserveIcon, let existingIcon = snapshots[typeId]?.iconName {
537+
resolved = snapshot.withIconName(existingIcon)
538+
}
539+
snapshots[typeId] = resolved
540+
for scheme in resolved.urlSchemes {
521541
schemeIndex[scheme.lowercased()] = typeId
522542
}
523543
}
@@ -594,15 +614,9 @@ final class PluginMetadataRegistry: @unchecked Sendable {
594614
let schemes = driverType.urlSchemes
595615
let primaryScheme = schemes.first ?? driverType.databaseTypeId.lowercased()
596616

597-
// Prefer the registry default's custom icon (e.g. "mysql-icon") over the
598-
// plugin's generic SF Symbol (e.g. "cylinder.fill"). The registry defaults
599-
// have curated SVG icons in the asset catalog.
600-
let existingIcon = snapshot(forTypeId: driverType.databaseTypeId)?.iconName
601-
let iconName = existingIcon ?? driverType.iconName
602-
603617
return PluginMetadataSnapshot(
604618
displayName: driverType.databaseDisplayName,
605-
iconName: iconName,
619+
iconName: driverType.iconName,
606620
defaultPort: driverType.defaultPort,
607621
requiresAuthentication: driverType.requiresAuthentication,
608622
supportsForeignKeys: driverType.supportsForeignKeys,

TablePro/Resources/Localizable.xcstrings

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13360,16 +13360,6 @@
1336013360
}
1336113361
}
1336213362
},
13363-
"Plugin was built with PluginKit version %lld, but version %lld or later is required. Please update the plugin." : {
13364-
"localizations" : {
13365-
"en" : {
13366-
"stringUnit" : {
13367-
"state" : "new",
13368-
"value" : "Plugin was built with PluginKit version %1$lld, but version %2$lld or later is required. Please update the plugin."
13369-
}
13370-
}
13371-
}
13372-
},
1337313363
"Plugins" : {
1337413364
"localizations" : {
1337513365
"vi" : {

TablePro/Views/Main/MainContentView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,11 @@ struct MainContentView: View {
491491
let tableName = selectedTab.tableName,
492492
let tabIndex = tabManager.selectedTabIndex
493493
{
494+
// columns is [] on initial load — buildFilteredQuery uses SELECT *
494495
let filteredQuery = coordinator.queryBuilder.buildFilteredQuery(
495496
tableName: tableName,
496497
filters: selectedTab.filterState.appliedFilters,
497-
columns: selectedTab.resultColumns,
498+
columns: [],
498499
limit: selectedTab.pagination.pageSize,
499500
offset: selectedTab.pagination.currentOffset
500501
)

0 commit comments

Comments
 (0)