Page MenuHomePhabricator

D6340.diff
No OneTemporary

D6340.diff

diff --git a/web/account/siwe.react.js b/web/account/siwe.react.js
--- a/web/account/siwe.react.js
+++ b/web/account/siwe.react.js
@@ -84,10 +84,18 @@
const logInExtraInfo = useSelector(webLogInExtraInfoSelector);
const [siweNonce, setSIWENonce] = React.useState<?string>(null);
+ const [
+ hasSIWEButtonBeenClicked,
+ setHasSIWEButtonBeenClicked,
+ ] = React.useState<boolean>(false);
+
+ const siweNonceShouldBeFetched =
+ !siweNonce &&
+ getSIWENonceCallLoadingStatus !== 'loading' &&
+ (signer || hasSIWEButtonBeenClicked);
React.useEffect(() => {
- if (!signer) {
- setSIWENonce(null);
+ if (!siweNonceShouldBeFetched) {
return;
}
dispatchActionPromise(
@@ -97,7 +105,7 @@
setSIWENonce(response);
})(),
);
- }, [dispatchActionPromise, getSIWENonceCall, signer]);
+ }, [dispatchActionPromise, getSIWENonceCall, siweNonceShouldBeFetched]);
const siweButtonColor = React.useMemo(
() => ({ backgroundColor: 'white', color: 'black' }),
@@ -164,6 +172,7 @@
}
const onSIWEButtonClick = React.useCallback(() => {
+ setHasSIWEButtonBeenClicked(true);
openConnectModal && openConnectModal();
}, [openConnectModal]);

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 2:12 PM (20 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2677655
Default Alt Text
D6340.diff (1 KB)

Event Timeline