Page MenuHomePhabricator

D12454.diff
No OneTemporary

D12454.diff

diff --git a/lib/components/qr-auth-provider.react.js b/lib/components/qr-auth-provider.react.js
--- a/lib/components/qr-auth-provider.react.js
+++ b/lib/components/qr-auth-provider.react.js
@@ -63,6 +63,7 @@
const [primaryDeviceID, setPrimaryDeviceID] = React.useState<?string>();
const [qrData, setQRData] = React.useState<?QRData>();
+ const [qrAuthFinished, setQRAuthFinished] = React.useState(false);
const {
setUnauthorizedDeviceID,
@@ -85,6 +86,7 @@
setUnauthorizedDeviceID(ed25519);
setQRData({ deviceID: ed25519, aesKey: aesKeyAsHexString });
+ setQRAuthFinished(false);
} catch (err) {
console.error('Failed to generate QR Code:', err);
}
@@ -104,7 +106,12 @@
);
React.useEffect(() => {
- if (!qrData || !socketState.isAuthorized || !primaryDeviceID) {
+ if (
+ !qrData ||
+ !socketState.isAuthorized ||
+ !primaryDeviceID ||
+ qrAuthFinished
+ ) {
return;
}
@@ -124,6 +131,7 @@
qrData,
socketState,
composeTunnelbrokerMessage,
+ qrAuthFinished,
]);
const tunnelbrokerMessageListener = React.useCallback(
@@ -171,6 +179,7 @@
backupDataKey,
backupLogDataKey,
});
+ setQRAuthFinished(true);
return;
}
@@ -199,7 +208,7 @@
);
React.useEffect(() => {
- if (!qrData?.deviceID) {
+ if (!qrData?.deviceID || qrAuthFinished) {
return undefined;
}
@@ -212,6 +221,7 @@
removeListener,
tunnelbrokerMessageListener,
qrData?.deviceID,
+ qrAuthFinished,
]);
const value = React.useMemo(

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 4:41 PM (20 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2597496
Default Alt Text
D12454.diff (1 KB)

Event Timeline