feat(datagrid): omit hidden columns from the table browse query#1375
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature
Requested: choose per table which columns to load before fetch, so a table with one heavy column opens fast.
Built on the existing per-table column visibility (you asked "why not based on column visibility?" — agreed, it's cleaner). Hiding a column now also leaves it out of the browse query, so it isn't fetched. This is a clean narrower
SELECT col_a, col_c, <pk>— no truncation, no aliasing, none of the corruption risk that removed the auto-SUBSTRINGin #1373.Behavior
UPDATEkeep working.SQLSchemaProvider.getColumns), so re-opening is fast — noSELECT *round-trip first.Trade-off (called out): hide/show is no longer a purely cosmetic instant toggle — it re-runs the query.
Implementation
ColumnFetchScope.selectColumns(schema:hidden:primaryKeys:)— pure, tested: full schema minus hidden, PK always kept,nilwhen nothing is omitted.TableQueryBuilderselectColumns:projection (nil⇒SELECT *).MainContentCoordinator+ColumnFetchScope— per-table schema-column cache (fromgetColumns),selectColumns(for:),requeryWithColumnScope, and the full-schema list for the picker. Cache cleared on schema reload / reset.FilterCoordinator(rebuild/apply/clear), the open path, and the visibility toggles.Tests
ColumnFetchScopeTestscovers the projection: drop hidden, keep order, PK-always-retained, empty schema, hide-everything-no-PK, and unknown columns.swiftlint --strictclean.