From ec2b94c6489fb75e9948e43daaa08062962306f6 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 29 Feb 2024 18:03:53 +0700 Subject: [PATCH 1/2] fix: app crash when upload pdf --- src/components/Attachments/AttachmentView/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Attachments/AttachmentView/index.js b/src/components/Attachments/AttachmentView/index.js index 56425f64a51c..f7b52eb8e7c8 100755 --- a/src/components/Attachments/AttachmentView/index.js +++ b/src/components/Attachments/AttachmentView/index.js @@ -160,8 +160,8 @@ function AttachmentView({ const encryptedSourceUrl = isAuthTokenRequired ? addEncryptedAuthTokenToURL(source) : source; const onPDFLoadComplete = (path) => { - if (path && (transaction.transactionID || reportActionID)) { - CachedPDFPaths.add(transaction.transactionID || reportActionID, path); + if (path && (transaction?.transactionID ?? reportActionID)) { + CachedPDFPaths.add(transaction?.transactionID ?? reportActionID, path); } if (!loadComplete) { setLoadComplete(true); From 07eb1584277c9c87f94739ab2177979f73c05448 Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 29 Feb 2024 18:20:42 +0700 Subject: [PATCH 2/2] fix lint --- src/components/Attachments/AttachmentView/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Attachments/AttachmentView/index.js b/src/components/Attachments/AttachmentView/index.js index f7b52eb8e7c8..f6a56dc73088 100755 --- a/src/components/Attachments/AttachmentView/index.js +++ b/src/components/Attachments/AttachmentView/index.js @@ -160,8 +160,9 @@ function AttachmentView({ const encryptedSourceUrl = isAuthTokenRequired ? addEncryptedAuthTokenToURL(source) : source; const onPDFLoadComplete = (path) => { - if (path && (transaction?.transactionID ?? reportActionID)) { - CachedPDFPaths.add(transaction?.transactionID ?? reportActionID, path); + const id = (transaction && transaction.transactionID) || reportActionID; + if (path && id) { + CachedPDFPaths.add(id, path); } if (!loadComplete) { setLoadComplete(true);