Page MenuHomePhabricator

D11794.diff
No OneTemporary

D11794.diff

diff --git a/native/account/siwe-panel.react.js b/native/account/siwe-panel.react.js
--- a/native/account/siwe-panel.react.js
+++ b/native/account/siwe-panel.react.js
@@ -80,7 +80,14 @@
const [primaryIdentityPublicKey, setPrimaryIdentityPublicKey] =
React.useState<?string>(null);
+ // This is set if we either succeed or fail, at which point we expect
+ // to be unmounted/remounted by our parent component prior to a retry
+ const nonceNotNeededRef = React.useRef(false);
+
React.useEffect(() => {
+ if (nonceNotNeededRef.current) {
+ return;
+ }
const generateNonce = async (nonceFunction: () => Promise<string>) => {
try {
const response = await nonceFunction();
@@ -89,7 +96,15 @@
Alert.alert(
UnknownErrorAlertDetails.title,
UnknownErrorAlertDetails.message,
- [{ text: 'OK', onPress: onClosing }],
+ [
+ {
+ text: 'OK',
+ onPress: () => {
+ nonceNotNeededRef.current = true;
+ onClosing();
+ },
+ },
+ ],
{ cancelable: false },
);
throw e;
@@ -158,10 +173,12 @@
if (data.type === 'siwe_success') {
const { address, message, signature } = data;
if (address && signature) {
+ nonceNotNeededRef.current = true;
closeBottomSheet?.();
await onSuccessfulWalletSignature({ address, message, signature });
}
} else if (data.type === 'siwe_closed') {
+ nonceNotNeededRef.current = true;
onClosing();
closeBottomSheet?.();
} else if (data.type === 'walletconnect_modal_update') {
@@ -181,6 +198,7 @@
const prevClosingRef = React.useRef<?boolean>();
React.useEffect(() => {
if (closing && !prevClosingRef.current) {
+ nonceNotNeededRef.current = true;
closeBottomSheet?.();
}
prevClosingRef.current = closing;

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 5, 12:47 AM (13 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2615330
Default Alt Text
D11794.diff (1 KB)

Event Timeline