From 9591067484b5f4aa016e9a643f164b9c31c99817 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Tue, 12 May 2020 15:43:15 +0200 Subject: [PATCH] replace map.getorelse with fold --- ts/IdentificationModal.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ts/IdentificationModal.tsx b/ts/IdentificationModal.tsx index 19c7beedbc4..654b9a37616 100644 --- a/ts/IdentificationModal.tsx +++ b/ts/IdentificationModal.tsx @@ -275,12 +275,15 @@ class IdentificationModal extends React.PureComponent { }); } - const previousAttempts = prevProps.identificationFailState - .map(x => x.remainingAttempts) - .getOrElse(Number.MAX_VALUE); - const currentAttempts = this.props.identificationFailState - .map(x => x.remainingAttempts) - .getOrElse(Number.MAX_VALUE); + const previousAttempts = prevProps.identificationFailState.fold( + Number.MAX_VALUE, + x => x.remainingAttempts + ); + + const currentAttempts = this.props.identificationFailState.fold( + Number.MAX_VALUE, + x => x.remainingAttempts + ); // trigger an update in the management of the updateInterval if the attempts or the state // `canInsertPinTooManyAttempts` is changed