Repository navigation
test-only: replay #1806 (smooth drag-and-drop reordering of relation chips) on master - #2423
jwalkingjew wants to merge 3 commits into
Conversation
Migrate the relation-chip reorder component to the next-gen dnd-kit (@dnd-kit/react + @dnd-kit/helpers). The classic sortable strategies compute transforms assuming uniform item sizes, which stretched, mis-spaced, or snapped variable-width chips in wrapped multi-row lists. The new library measures the real DOM and FLIP-animates optimistic reordering, so wrapped chip rows reflow smoothly and land correctly. Positions are committed on drop, reusing the existing position set. - reorderable-relation-chips-dnd.tsx: rewritten on DragDropProvider/ useSortable; adds afterChips slot so the add-entity button lives inside the flex-wrapped list - chip.tsx: LinkableRelationChip accepts sortableDragHandleRef (the new API marks handles via callback ref); dots button unchanged - editable-entity-page.tsx: renders the add button via afterChips; IMAGE/VIDEO branching normalized to renderableTypeStrict - vitest.setup.ts: stub ResizeObserver in the test environment; @dnd-kit/dom references it at module scope and jsdom does not implement it Replays PR #1806 on current master so a Vercel preview can be tested. The only change from that branch: master has since added its own vitest.setup.ts (the network-refusal guard) and wired setupFiles in vite.config.js, so the ResizeObserver stub is appended to master's setup file rather than creating one, and the duplicate setupFiles key is dropped. Co-authored-by: Juan Mardikian <developermardikian@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Checked this while auditing the PR queue, and it is worth un-parking. The bug it replays is still live on master. I briefly closed #1806 in a sweep of stale conflicting PRs and have reopened it — that was my error, and this PR is the evidence I should have looked at first. This looks like the landable artifact, not #1806. That branch is 378 commits behind for the sake of one component; this one is on master, So "not for merge — review and merge the original" is the more expensive path by a wide margin. Un-drafting this and landing it looks strictly better, unless preserving #1806 as the merged artifact matters for reasons outside the code. One thing to confirm before it lands, since it is the part most likely to bite: the |
Replay of #1806 on current
master, opened so a Vercel preview builds and the drag behavior can be tested. #1806 is 378 commits behind master and conflicting, so its preview is unusable. Not for merge — test target only. Review and merge the original.What
Makes drag-and-drop reordering of relation chips feel smooth, including wrapped multi-row chip lists.
How
Migrates this one component to the next-gen dnd-kit:
@dnd-kit/react+@dnd-kit/helpers(0.5.0) — measures the real DOM and FLIP-animates optimistic reordering, so variable-width wrapped chips reflow smoothly and land correctly. Reordering is optimistic during the drag; positions are committed on drop by reassigning the existing position set (same scheme as before).chip.tsx:LinkableRelationChipgains an optionalsortableDragHandleRef(the new API marks drag handles via callback ref instead of spread listeners). The dots button remains the handle; grab UX unchanged.editable-entity-page.tsx: the add-entity button moves into the chip list via the newafterChipsslot; IMAGE/VIDEO branching normalized torenderableTypeStrict(behavior-equivalent).The classic
@dnd-kit/core/@dnd-kit/sortablepackages remain — other surfaces (table rows, tabs, etc.) still use them; the libraries coexist.Differences from #1806
Content is identical apart from one conflict that master's movement forced:
vitest.setup.tsdid not exist when fix: smooth drag-and-drop reordering of relation chips #1806 branched. Master has since added it (the unmocked-network guard) and wiredsetupFilesinvite.config.js. So theResizeObserverstub — needed because@dnd-kit/domreferencesResizeObserverat module scope and jsdom does not implement it — is appended to master's setup file instead of creating one, and fix: smooth drag-and-drop reordering of relation chips #1806's duplicatesetupFileskey invite.config.jsis dropped (vite.config.jsis now unchanged from master).reorderable-relation-chips-dnd.tsxis byte-identical to #1806. Original authorship preserved on the commit.Verification on this branch
bun installleavesbun.lockunchanged — lockfile is consistent with master's dependency settsc --noEmit: only the 3 pre-existing failures already on master; none in the touched filesbun run build: passes