Fix wallet priority reorder

This commit is contained in:
ekzyis 2024-11-04 20:02:52 +01:00
parent 8ab44e19fd
commit bcaa135270
1 changed files with 2 additions and 3 deletions

View File

@ -20,11 +20,10 @@ export default function Wallet ({ ssrData }) {
const reorder = useCallback(async (sourceIndex, targetIndex) => {
const newOrder = [...wallets.filter(w => w.config?.enabled)]
const [source] = newOrder.splice(sourceIndex, 1)
const newTargetIndex = sourceIndex < targetIndex ? targetIndex - 1 : targetIndex
const priorities = newOrder.slice(0, newTargetIndex)
const priorities = newOrder.slice(0, targetIndex)
.concat(source)
.concat(newOrder.slice(newTargetIndex))
.concat(newOrder.slice(targetIndex))
.map((w, i) => ({ wallet: w, priority: i }))
await setPriorities(priorities)