Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3406132
D11794.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11794.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D11794: [native] Don't refetch nonce after SIWE is complete
Attached
Detach File
Event Timeline
Log In to Comment