From e902b67a63949b6fe8ea7ec31d0c129480990756 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Sun, 19 Oct 2025 09:40:11 -0700 Subject: [PATCH] Replace `arrayMove` with custom implementation in `PairEditor` to remove dependency on `@dnd-kit/sortable`. --- src-web/components/core/PairEditor.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src-web/components/core/PairEditor.tsx b/src-web/components/core/PairEditor.tsx index c90d8614..521c52ca 100644 --- a/src-web/components/core/PairEditor.tsx +++ b/src-web/components/core/PairEditor.tsx @@ -10,7 +10,6 @@ import { useSensor, useSensors, } from '@dnd-kit/core'; -import { arrayMove } from '@dnd-kit/sortable'; import classNames from 'classnames'; import { forwardRef, @@ -261,7 +260,13 @@ export const PairEditor = forwardRef(function Pa const to = hoveredIndex ?? (baseTo === -1 ? from : baseTo); if (from !== -1 && to !== -1 && from !== to) { - setPairsAndSave((ps) => arrayMove(ps, from, to > from ? to - 1 : to)); + setPairsAndSave((ps) => { + const next = [...ps]; + const [moved] = next.splice(from, 1); + if (moved === undefined) return ps; // Make TS happy + next.splice(to > from ? to - 1 : to, 0, moved); + return next; + }); } }, [pairs, hoveredIndex, setPairsAndSave],