From b8178b6a8c864b5b0aa1ff7469e7b42bb8556f2e Mon Sep 17 00:00:00 2001 From: Ngo Quoc Dat Date: Mon, 13 Jul 2026 19:06:44 +0700 Subject: [PATCH] fix(datagrid): show column comments in headers on first load (#1861) --- CHANGELOG.md | 1 + .../Views/Results/DataGridColumnPool.swift | 18 +++- .../Results/DataGridUpdateSnapshot.swift | 2 +- TablePro/Views/Results/DataGridView.swift | 37 +++++--- .../Views/Results/SortableHeaderCell.swift | 12 ++- .../Views/Results/SortableHeaderView.swift | 23 ++--- .../Results/DataGridColumnPoolTests.swift | 89 ++++++++++++++++++- .../Results/DataGridUpdateSnapshotTests.swift | 19 +++- .../Results/SortableHeaderViewTests.swift | 83 +++++++++++++++++ 9 files changed, 242 insertions(+), 42 deletions(-) create mode 100644 TableProTests/Views/Results/SortableHeaderViewTests.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 9751d9fdb..595497639 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Column comments now show in the data grid header as soon as the table opens, instead of only after the query was run again. The header also grows to fit the comment line, so it is no longer cut off until a column is resized. (#1861) - **Size to Fit** and **Size All Columns to Fit** no longer stretch a column with long text far past the window. A fitted column now stops at half the visible grid, and every column has a maximum width, so a column left oversized before is brought back in range the next time you open the table. - The username is now optional. Leaving it empty, or importing a connection URL that has no user in it, no longer fills in `root`. An empty username lets the database use its own default, the same as `psql` and `mysql` do: your Mac login name on MySQL/MariaDB and PostgreSQL, and `default` on ClickHouse. The `~/.pgpass` lookup now matches on that same user. - A failed or cancelled connection that uses a Cloudflare tunnel no longer leaves the `cloudflared` process running in the background. diff --git a/TablePro/Views/Results/DataGridColumnPool.swift b/TablePro/Views/Results/DataGridColumnPool.swift index 08bcf3e88..9da21d528 100644 --- a/TablePro/Views/Results/DataGridColumnPool.swift +++ b/TablePro/Views/Results/DataGridColumnPool.swift @@ -41,6 +41,7 @@ final class DataGridColumnPool { let willRestoreWidths = !(savedLayout?.columnWidths.isEmpty ?? true) let hiddenFromLayout = savedLayout?.hiddenColumns ?? [] + var commentsChanged = false for slot in 0..