MCPcopy Create free account
hub / github.com/WebDevSimplified/course-platform / getNewArray

Function getNewArray

src/components/SortableList.tsx:37–41  ·  view source on GitHub ↗
(array: T[], activeId: string, overId: string)

Source from the content-addressed store, hash-verified

35 if (overId == null || activeId == null) return
36
37 function getNewArray(array: T[], activeId: string, overId: string) {
38 const oldIndex = array.findIndex(section => section.id === activeId)
39 const newIndex = array.findIndex(section => section.id === overId)
40 return arrayMove(array, oldIndex, newIndex)
41 }
42
43 startTransition(async () => {
44 setOptimisticItems(items => getNewArray(items, activeId, overId))

Callers 1

handleDragEndFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected