From 1a60f13d72bb0f9d4b560cc8a44a94f7d1d84e68 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Mon, 8 Jul 2024 11:06:46 +0200 Subject: [PATCH] Fix order if wallet with no priority exists --- pages/settings/wallets/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pages/settings/wallets/index.js b/pages/settings/wallets/index.js index 01b0b8ba..a281e51f 100644 --- a/pages/settings/wallets/index.js +++ b/pages/settings/wallets/index.js @@ -95,6 +95,12 @@ export default function Wallet ({ ssrData }) { // delta is NaN if either priority is undefined if (!Number.isNaN(delta) && delta !== 0) return delta + // if one wallet has a priority but the other one doesn't, the one with the priority comes first + if (w1.priority !== undefined && w2.priority === undefined) return -1 + if (w1.priority === undefined && w2.priority !== undefined) return 1 + + // both wallets have no priority set, falling back to other methods + // if both wallets have an id, use that as tie breaker // since that's the order in which autowithdrawals are attempted if (w1.id && w2.id) return Number(w1.id) - Number(w2.id)