From ce1ab8b039c9603014ca33ee32b6d199daa1d12f Mon Sep 17 00:00:00 2001 From: Agustin Pane Date: Wed, 24 Feb 2021 13:54:48 -0300 Subject: [PATCH] Avoid to remove the current loaded safe data if the batch request fail (#1847) Co-authored-by: nicolas Co-authored-by: Daniel Sanchez --- src/logic/safe/store/actions/fetchSafe.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/logic/safe/store/actions/fetchSafe.ts b/src/logic/safe/store/actions/fetchSafe.ts index 43def162..014e6e26 100644 --- a/src/logic/safe/store/actions/fetchSafe.ts +++ b/src/logic/safe/store/actions/fetchSafe.ts @@ -122,13 +122,16 @@ export const checkAndUpdateSafe = (safeAdd: string) => async (dispatch: Dispatch name: localSafe?.name, modules, spendingLimits, - nonce: Number(remoteNonce), - threshold: Number(remoteThreshold), + nonce: remoteNonce ? Number(remoteNonce) : undefined, + threshold: remoteThreshold ? Number(remoteThreshold) : undefined, featuresEnabled: localSafe?.currentVersion ? enabledFeatures(localSafe.currentVersion) : localSafe?.featuresEnabled, } dispatch(updateSafe(updatedSafe)) + if (!remoteOwners.length) { + return + } // If the remote owners does not contain a local address, we remove that local owner localOwners.forEach((localAddress) => { const remoteOwnerIndex = remoteOwners.findIndex((remoteAddress) => sameAddress(remoteAddress, localAddress))