Skip to content

test-only: replay #1806 (smooth drag-and-drop reordering of relation chips) on master - #2423

Open
jwalkingjew wants to merge 3 commits into
masterfrom
preston/pr-1806-dnd-chips-retest
Open

jwalkingjew wants to merge 3 commits into
masterfrom
preston/pr-1806-dnd-chips-retest

Conversation

@jwalkingjew

Copy link
Copy Markdown
Collaborator

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: LinkableRelationChip gains an optional sortableDragHandleRef (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 new afterChips slot; IMAGE/VIDEO branching normalized to renderableTypeStrict (behavior-equivalent).

The classic @dnd-kit/core/@dnd-kit/sortable packages 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:

reorderable-relation-chips-dnd.tsx is byte-identical to #1806. Original authorship preserved on the commit.

Verification on this branch

  • bun install leaves bun.lock unchanged — lockfile is consistent with master's dependency set
  • tsc --noEmit: only the 3 pre-existing failures already on master; none in the touched files
  • bun run build: passes
  • Full vitest suite: 462 files / 5122 tests passing

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>
@vercel

vercel Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
geogenesis Ready Ready Preview Sep 20, 2026 2:29am UTC

Request Review

@ohohoreilly

Copy link
Copy Markdown
Contributor

Checked this while auditing the PR queue, and it is worth un-parking.

The bug it replays is still live on master. reorderable-relation-chips-dnd.tsx there still imports @dnd-kit/core / @dnd-kit/sortable with CSS.Transform, and @dnd-kit/react is not in package.json. Nothing else has landed the migration since May, so wrapped multi-row chip lists still reorder the way #1806 set out to fix.

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, reorderable-relation-chips-dnd.tsx is byte-identical to it, original authorship is preserved on the commit, and it reports tsc clean, build passing, bun.lock unchanged, and 462 files / 5122 tests green.

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 ResizeObserver stub appended to vitest.setup.ts. @dnd-kit/dom touches ResizeObserver at module scope and jsdom does not implement it, so that stub is load-bearing for every test file the setup touches — not just these. Worth a look that it cannot mask a real missing-observer failure elsewhere.

@ohohoreilly
ohohoreilly marked this pull request as ready for review September 20, 2026 02:23

This branch was successfully deployed

1 active deployment
Preview — f7f79204 Deployed Sep 20, 2026 by vercel[bot]
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.

3 participants