Skip to content

refactor: favorites system rewrite #797

Merged
datlechin merged 14 commits intomainfrom
refactor/favorites-rewrite
Apr 19, 2026
Merged

refactor: favorites system rewrite #797
datlechin merged 14 commits intomainfrom
refactor/favorites-rewrite

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Summary

Full rewrite of the favorites system addressing issue #779 and 40+ additional issues found during deep analysis.

Interaction model:

  • Single-click selects only (no longer inserts query into editor)
  • Return key inserts selected favorite into editor
  • Return key correctly skipped during folder rename

Save as Favorite (Cmd+D):

  • Added to Query menu with Cmd+D shortcut (Apple standard for bookmarks)
  • Notification-based flow works regardless of which sidebar tab is active
  • Dialog auto-generates name from first -- comment or first SQL line
  • Folder picker available from all entry points (sidebar, Cmd+D, history)

HIG compliance:

  • ContentUnavailableView for both Tables and Favorites empty states (consistent)
  • Empty states centered vertically
  • Form labels without trailing colons
  • Dialog title ("New Favorite" / "Edit Favorite")
  • First-responder focus on Name field
  • Context menu reordered: primary actions first, no trash icon on destructive items
  • Localization fixes: String(format:) instead of Text interpolation in alerts

Storage:

  • Batch deleteFavorites(ids:) replaces N+1 serial loop
  • fetchFavorite(id:) targeted single-row query
  • Removed dead SyncChangeTracker calls (phantom iCloud sync)
  • Schema migration v2: removed unused is_synced column
  • sqlite3_close_v2 fixes deinit data race
  • Error logging in execute()

Default scope: Connection-scoped (not global) — consistent across all entry points

Test plan

  • Cmd+D with SQL in editor → dialog opens with auto-generated name, folder picker
  • Cmd+D with empty editor → menu item disabled
  • Single-click favorite → selects only, does NOT insert into editor
  • Return key on selected favorite → inserts into editor
  • Return key during folder rename → commits rename (not insert)
  • Create folder → inline rename activates correctly
  • Delete favorite → confirmation alert shown
  • Empty state → centered ContentUnavailableView (both Tables and Favorites)
  • Save from history panel → dialog works, folder picker available
  • Global toggle defaults OFF (connection-scoped)

@datlechin datlechin changed the title refactor: favorites system rewrite — HIG compliance, Cmd+D, auto-name, folder picker refactor: favorites system rewrite Apr 19, 2026
@datlechin datlechin merged commit 4f59dee into main Apr 19, 2026
2 checks passed
@datlechin datlechin deleted the refactor/favorites-rewrite branch April 19, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant