Skip to content

Commit

Permalink
Fix wallet priority reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzyis committed Nov 4, 2024
1 parent 8ab44e1 commit bcaa135
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pages/settings/wallets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bcaa135

Please sign in to comment.