diff --git a/src-web/components/Sidebar.tsx b/src-web/components/Sidebar.tsx index e0d8e08f..b446567b 100644 --- a/src-web/components/Sidebar.tsx +++ b/src-web/components/Sidebar.tsx @@ -152,6 +152,15 @@ export const Sidebar = memo(function Sidebar({ className }: Props) { return (
+ + + createRequest.mutate({})} + /> +
- - - createRequest.mutate({})} - /> - index) newRequests.splice(hoveredIndex - 1, 0, request); else newRequests.splice(hoveredIndex, 0, request); - const beforePriority = newRequests[hoveredIndex - 1]?.sortPriority ?? 0; - const afterPriority = newRequests[hoveredIndex + 1]?.sortPriority ?? 0; + // Do a simple find because the math is too hard + const newIndex = newRequests.findIndex((r) => r.id === requestId) ?? 0; + const beforePriority = newRequests[newIndex - 1]?.sortPriority ?? 0; + const afterPriority = newRequests[newIndex + 1]?.sortPriority ?? 0; const shouldUpdateAll = afterPriority - beforePriority < 1; if (shouldUpdateAll) { @@ -255,7 +253,7 @@ function SidebarItems({ requests, focused, selectedIndex, onSelect }: SidebarIte key={r.id} selected={selectedIndex === i} requestId={r.id} - requestName={r.name} + requestName={r.name + ' ' + r.sortPriority} onMove={handleMove} onEnd={handleEnd} useProminentStyles={focused}