feat(sidebar): drag-and-drop connection reordering (#748) - #817
Open
Asgabani wants to merge 1 commit into
Open
Conversation
Connections render in a persisted custom order rather than storage's natural array order. A new connection_order collection (flat id list) is stored via the existing write-through storage facade, and ConnectionsList gains native HTML5 drag-and-drop to reorder its rows, persisting the new order on drop.
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.
Closes #748.
What changed
StorageData.connection_order(new collection): a flat list of connection ids in the user's preferred order, mirroring the existingdismissed_seeds-style separate-list pattern rather than a field onDatabaseConnection— amanaged:trueconnection is replaced wholesale on every load (seemergeManagedConnections), so a field on the connection object itself would be silently discarded on reload.storage.getConnectionOrder()/storage.setConnectionOrder()on the storage facade, wired intouseStorageSync's migrate/pull paths like every other collection.applyConnectionOrder()(src/lib/connection-order.ts): sorts a connections array by the persisted order; a connection absent from the order (never dragged, or created after the user last reordered) sorts after every connection the order does know about, in its original relative position (Array.prototype.sortis spec-stable, so that fallback needs no code of its own).useConnectionOrder()hook:useSyncExternalStoreover the facade, same shape as the repo's other storage-backed hooks.ConnectionsList/ConnectionItem: native HTML5 drag-and-drop (no new dependency) — a drag handle appears on hover onceonReorderConnectionsis passed and the list has more than one connection; dropping persists the new order via the facade.Note on #694
#748's "Done when" mentions #694 (favorites): if that lands first, a favorited group should keep its own drag order rather than the two features competing for one order field. Since #694 hasn't merged yet, this PR reorders the flat
connectionslist only.connectionOrder/onReorderConnectionsare threaded through as plain optional props (not baked into any favorites-aware grouping), so whichever PR lands second can partition the already-ordered list into favorite/non-favorite groups without this one needing to change.Testing
Ran locally (
bun run format && bun run lint && bun run typecheck && bun run knip && bun run chart:check && bun run channels:showcase:check && bun run readme:check && bun run security:check && bun run test && bun run build, plusbun run build:lib && bun run attw):git stash).bun run test:components: 39/39 groups pass.bun run test: same 13 pre-existing failures as a clean checkout (Helm binary not installed, missing built standalone zip) — verified identical viagit stashbefore/after. No live Postgres/MySQL in this sandbox, so DB-integration tests weren't exercised beyond what's already mocked.bun run test:coverage && bun run coverage:check: 100.00% line coverage on the merged lcov.bun run build,bun run build:lib,bun run attw: all succeed (ConnectionsList/Sidebarare reachable from the embeddable workspace export surface).If CI surfaces something this sandbox couldn't (Helm chart tests, live DB integration tests), happy to fix it up.