Page MenuHomePhabricator

D11794.id39520.diff
No OneTemporary

D11794.id39520.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 doneRef = React.useRef(false);
+
React.useEffect(() => {
+ if (doneRef.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: () => {
+ doneRef.current = true;
+ onClosing();
+ },
+ },
+ ],
{ cancelable: false },
);
throw e;
@@ -158,10 +173,12 @@
if (data.type === 'siwe_success') {
const { address, message, signature } = data;
if (address && signature) {
+ doneRef.current = true;
closeBottomSheet?.();
await onSuccessfulWalletSignature({ address, message, signature });
}
} else if (data.type === 'siwe_closed') {
+ doneRef.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) {
+ doneRef.current = true;
closeBottomSheet?.();
}
prevClosingRef.current = closing;

File Metadata

Mime Type
text/plain
Expires
Mon, Sep 30, 2:26 AM (21 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2203473
Default Alt Text
D11794.id39520.diff (1 KB)

Event Timeline