Skip to content

Commit e676cdc

Browse files
authored
fix: show dropdown chevron buttons on first table open (#482)
* fix: show dropdown chevron buttons on first table open * fix: add CHANGELOG entry for dropdown chevron fix
1 parent e0b9793 commit e676cdc

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020

2121
- MongoDB Atlas connections failing with "TLS certificate verify failed" due to missing CA bundle
2222

23+
### Fixed
24+
25+
- ENUM/SET dropdown chevron buttons not showing on first table open, requiring a refresh to appear
26+
2327
## [0.25.0] - 2026-03-27
2428

2529
### Added

TablePro/Views/Main/Extensions/MainContentCoordinator+QueryHelpers.swift

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ extension MainContentCoordinator {
2121
let columnNullable: [String: Bool]
2222
let primaryKeyColumn: String?
2323
let approximateRowCount: Int?
24+
let columnEnumValues: [String: [String]]
2425
}
2526

2627
/// Schema result from parallel or sequential metadata fetch
@@ -38,12 +39,22 @@ extension MainContentCoordinator {
3839
for fk in schema.fkInfo {
3940
fks[fk.column] = fk
4041
}
42+
// Parse enum/set values from column type definitions (MySQL, MariaDB, ClickHouse)
43+
var enumValues: [String: [String]] = [:]
44+
for col in schema.columnInfo {
45+
if let values = ColumnType.parseEnumValues(from: col.dataType) {
46+
enumValues[col.name] = values
47+
} else if let values = ColumnType.parseClickHouseEnumValues(from: col.dataType) {
48+
enumValues[col.name] = values
49+
}
50+
}
4151
return ParsedSchemaMetadata(
4252
columnDefaults: defaults,
4353
columnForeignKeys: fks,
4454
columnNullable: nullable,
4555
primaryKeyColumn: schema.columnInfo.first(where: { $0.isPrimaryKey })?.name,
46-
approximateRowCount: schema.approximateRowCount
56+
approximateRowCount: schema.approximateRowCount,
57+
columnEnumValues: enumValues
4758
)
4859
}
4960

@@ -132,6 +143,9 @@ extension MainContentCoordinator {
132143
updatedTab.columnDefaults = metadata.columnDefaults
133144
updatedTab.columnForeignKeys = metadata.columnForeignKeys
134145
updatedTab.columnNullable = metadata.columnNullable
146+
for (col, vals) in metadata.columnEnumValues {
147+
updatedTab.columnEnumValues[col] = vals
148+
}
135149
if let approxCount = metadata.approximateRowCount, approxCount > 0 {
136150
updatedTab.pagination.totalRowCount = approxCount
137151
updatedTab.pagination.isApproximateRowCount = true
@@ -278,8 +292,16 @@ extension MainContentCoordinator {
278292
guard capturedGeneration == queryGeneration else { return }
279293
guard !Task.isCancelled else { return }
280294
if let idx = tabManager.tabs.firstIndex(where: { $0.id == tabId }) {
281-
tabManager.tabs[idx].columnEnumValues = columnEnumValues
282-
tabManager.tabs[idx].metadataVersion += 1
295+
let existing = tabManager.tabs[idx].columnEnumValues
296+
let hasNewValues = columnEnumValues.contains { key, value in
297+
existing[key] != value
298+
}
299+
if hasNewValues {
300+
for (col, vals) in columnEnumValues {
301+
tabManager.tabs[idx].columnEnumValues[col] = vals
302+
}
303+
tabManager.tabs[idx].metadataVersion += 1
304+
}
283305
}
284306
}
285307
}

0 commit comments

Comments
 (0)