From bcaa135270eb4f283b3c8f3b4e9c21d6689533ac Mon Sep 17 00:00:00 2001 From: ekzyis Date: Mon, 4 Nov 2024 20:02:52 +0100 Subject: [PATCH] Fix wallet priority reorder --- pages/settings/wallets/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pages/settings/wallets/index.js b/pages/settings/wallets/index.js index 8549eee0..a8330c83 100644 --- a/pages/settings/wallets/index.js +++ b/pages/settings/wallets/index.js @@ -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)