π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Retry QR decoder import after failures
Manav Rathic994870f9706
diff --git a/web/apps/twoof3/src/features/twoof3/utils/qrCode.ts b/web/apps/twoof3/src/features/twoof3/utils/qrCode.tsindex c7345ec61c..ec0612973f 100644--- a/web/apps/twoof3/src/features/twoof3/utils/qrCode.ts+++ b/web/apps/twoof3/src/features/twoof3/utils/qrCode.ts@@ -17,6 +17,17 @@ let decodeQrPromise: Promise<(typeof import("qr/decode.js"))["default"]> | null = null;+const loadDecodeQr = () => {+ decodeQrPromise ??= import("qr/decode.js")+ .then(({ default: decodeQR }) => decodeQR)+ .catch((error: unknown) => {+ decodeQrPromise = null;+ throw error;+ });++ return decodeQrPromise;+};+interface DecodableImage {data: Uint8ClampedArray | number[];height: number;@@ -157,11 +168,7 @@ const cropImage = (};const decodeQrImage = async (image: DecodableImage) => {- decodeQrPromise ??= import("qr/decode.js").then(({ default: decodeQR }) => {- return decodeQR;- });-- const decodeQR = await decodeQrPromise;+ const decodeQR = await loadDecodeQr();const attempts: {image: DecodableImage;options?: { cropToSquare?: boolean };