Merge pull request #1536 from stackernews/fix-wallet-priority-reorder

Fix wallet priority reorder inconsistency
This commit is contained in:
Keyan 2024-11-04 18:50:07 -06:00 committed by GitHub
commit 6feaf383b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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)