feat(sidebar): Drag to reorder nav items in customize dialog#3670
Merged
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
2 tasks
charlesvien
marked this pull request as ready for review
July 22, 2026 02:55
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
Prompt To Fix All With AIFix the following 3 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 3
packages/ui/src/features/sidebar/constants.ts:115-116
**Repeated Hover Reverses The Move**
`dragover` can fire repeatedly while the pointer remains over one target, but this move is not idempotent. Moving adjacent `A` onto `B` first produces `[B, A]`; the next event with the same source and target restores `[A, B]`, so rows can oscillate and the persisted drop order depends on the number of pointer events.
### Issue 2 of 3
packages/ui/src/features/sidebar/constants.ts:97-102
**New Items Lose Default Position**
Every ID missing from a stored order receives a position after all stored IDs. Once an existing user has dragged and persisted the current full list, a newly shipped item inserted in the middle of `CUSTOMIZABLE_NAV_ITEMS` is therefore rendered at the end instead of its default position, giving existing users the wrong navigation order.
### Issue 3 of 3
packages/ui/src/features/sidebar/components/CustomizeSidebarDialog.tsx:83-90
**Unmount Leaves Intermediate Order Persisted**
Each hover immediately writes an intermediate order to the persisted store, while restoration exists only in `handleDragEnd`. If the dialog closes or its provider unmounts during an active drag before that callback runs, the last hover position remains saved even though the drag was never dropped.
Reviews (1): Last reviewed commit: "add drag to reorder nav items in customi..." | Re-trigger Greptile |
|
😎 This pull request was merged. |
charlesvien
force-pushed
the
feat/sidebar-nav-reorder
branch
from
July 22, 2026 03:07
f5fdc20 to
418c147
Compare
There was a problem hiding this comment.
Contained UI/store feature (drag-to-reorder sidebar items), no risky territory touched; the three prior Greptile findings (oscillating dragover, new items losing position, intermediate order persisting on unmount) are each fixed in the current diff with matching new tests, and the author has strong familiarity with this code.
- Author wrote 100% of the modified lines and has 23 merged PRs in these paths (familiarity STRONG).
- 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 270L, 5F substantive, 569L/9F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (569L, 9F, single-area, feat) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ f3e4b42 · reviewed head 4265c4c |
charlesvien
enabled auto-merge (squash)
July 22, 2026 03:18
charlesvien
disabled auto-merge
July 22, 2026 03:35
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.

Problem
The customize sidebar dialog lets you show or hide nav items, but their order is fixed.
Changes
Adds a drag handle to each row in the customize dialog. Dragging reorders the list live, persists the order and the sidebar nav renders in that order (hidden items keep it under More too). A canceled drag restores the order from dragstart. Reorders fire a new "Sidebar reordered" event. Stored order is sanitized on rehydrate and newly shipped items fall back to their default position.
How did you test this?
Unit tests for the order helpers, store rehydration and the dialog drag handlers (116 sidebar tests pass), plus typecheck and Biome. Not exercised in the running app.
Automatic notifications