feat(sidebar): add favorite tables with iCloud sync and sidebar improvements#1422
Conversation
|
Thank you for your contribution! Before we can merge this PR, you need to sign our Contributor License Agreement. To sign, please comment below with:
I have read the CLA Document and I hereby sign the CLA. 1 out of 2 committers have signed the CLA. |
|
I have read the CLA Document and I hereby sign the CLA. |
723ac5f to
d8b7166
Compare
Code reviewThree features in one PR: table favorites with iCloud sync, in-memory recent tables, and sidebar UX (plus button, dynamic window min, conditional Maintenance menu). The split is reasonable and the test coverage on the value types ( Blockers1. Sync push/clear is not gated by a sync settings toggle. Every existing record type wraps its push, clear, and tombstone-removal in collectDirtyTableFavorites(into: &recordsToSave, deletions: &recordIDsToDelete, zoneID: zoneID)
...
changeTracker.clearAllDirty(.tableFavorite)
for tombstone in metadataStorage.tombstones(for: .tableFavorite) {
metadataStorage.removeTombstone(type: .tableFavorite, id: tombstone.id)
}Either add 2. "View ER Diagram" silently removed from the sidebar right-click menu. The CHANGELOG only mentions removing "Create New Table…", but the diff also drops: -Button(String(localized: "View ER Diagram")) {
- coordinator?.showERDiagram()
-}The Favorites tab still has it, but right-click on any sidebar table no longer does. Either restore it (it's the documented entry point for many users) or add a CHANGELOG 3. Localizable.xcstrings carries unrelated stale flags. The PR legitimately marks
These look like collateral from running the contributor's local Xcode against a different working tree. Revert those stale flags — they'll corrupt the catalog and silently kill translations elsewhere. 4. UI test bar moved, then under-met. This PR edits CLAUDE.md to add a requirement that UI/user-flow changes include 5. Merge conflicts. Three files now conflict with
Rebase and reapply before re-review. Design concerns6. Favorites are global by table name with no qualifier.
The CLAUDE.md storage table addition documents this as the design, but it doesn't match how DataGrip, TablePlus, or Postico scope favorites (per-connection or per-(connection,schema)). At minimum, key by 7. 8. 9. 10. CLAUDE.md changes in a feature PR. The PR rewords mandatory rule #4 and principle #7, and adds a Lower-priority observations
TestsThe new unit tests are well-scoped. Gaps worth closing:
Verification statusPR description has VerdictNot mergeable as-is. The sync gating (#1), the silent menu removal (#2), the unrelated stale strings (#3), and the merge conflicts (#5) are hard blockers. The favorites scoping (#6) and the storage thread-safety (#7) are design issues I'd push back on before this lands — they're the kind of thing that's easy to fix now and very hard to fix once user data is in the wild and syncing. Happy to walk through any of these in more depth. |
…verflow fix - Recent tables section at top of Tables sidebar (last 10 per connection/database, in-memory, clears on quit). RecentTablesStore pushes on every openTableTab call. - TableRow trailing star button toggles favorite inline; overlay star badge removed. Add/Remove Favorites dropped from SidebarContextMenu (star button replaces it). - Favorites tab now has only Tables and Queries sections (Recent removed). - Plus button next to sidebar search field opens Create Table tab; disabled in safe mode. - Window minimum width now recomputes dynamically when sidebar or inspector collapse/expand, preventing layout overflow on small windows.
- feat(sync): add syncTableFavorites toggle to SyncSettings and SyncSection - refactor(sidebar): scope FavoriteTablesStorage by (connectionId, schema, name) instead of global table name - fix(sync): gate tableFavorite push/apply/clear behind syncTableFavorites setting - fix(storage): add NSLock to FavoriteTablesStorage for thread safety - refactor(storage): change RecentTablesStore.Key.database to String? with nilIfEmpty convention - fix(changelog): add View ER Diagram removal entry - test: update FavoriteTablesStorageTests for connection-scoped favorites - test: update SyncRecordMapperFavoriteTableTests with connectionId and schema - test: add nil-database test to RecentTablesStoreTests - test(ui): add window minimum size assertion
ReviewOverviewSubstantial sidebar feature work (+1,230 / −82 across 35 files). Adds three user-facing capabilities plus supporting work:
Correctness🔴 Duplicate
|
…solation, cleanups
# Conflicts: # CHANGELOG.md # TablePro/Resources/Localizable.xcstrings
# Conflicts: # CHANGELOG.md
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
…eparator on scroll)
… on favorite table rows
… the favorites tree
…ection by database
# Conflicts: # CHANGELOG.md # TablePro/Views/Sidebar/FavoritesTabView.swift # TablePro/Views/Sidebar/SchemaPickerControl.swift # TablePro/Views/Sidebar/SidebarContextMenu.swift # TablePro/Views/Sidebar/SidebarView.swift # TablePro/Views/Sidebar/TableRowView.swift # TableProTests/Views/TableRowLogicTests.swift
Summary
FavoriteTableCloudKit record). The filled star is always visible as a status indicator; the empty star reveals on hover (the Apple Music pattern).Internals / refactors
FavoriteSelection) replaces the previous string-prefix routing in the Favorites tab; dispatch switches on the enum andFavoriteNode.content.AnyView, keeping per-folder expansion state.SchemaPickerControl; accessibility labels/actions added to favorite rows.Tests
FavoriteTablesStorage: dirty/tombstone tracking, connection/database/schema scoping, toggle idempotence.SyncRecordMapper: favorite record round-trip (including database).FavoriteSelection: raw-value round-trip and invalid/legacy decoding.Manual QA
The Favorites > Queries tree (select / right-click / double-click / Delete / folder rename / expand-collapse persistence / linked files) went through the selection-model and row-view refactor and is not unit-testable. Please verify manually.
Checklist
CHANGELOG.mdupdated under[Unreleased]docs/(favorites.mdx, table-operations.mdx, icloud-sync.mdx)swiftlint lint --strict