From f0e52093bfe2184449816f80d5cb1cb2035666e1 Mon Sep 17 00:00:00 2001 From: Abdelrahman Khattab Date: Fri, 12 Apr 2024 09:46:21 +0200 Subject: [PATCH] Fixing not here page in empty notes --- .../home/report/withReportAndPrivateNotesOrNotFound.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/home/report/withReportAndPrivateNotesOrNotFound.tsx b/src/pages/home/report/withReportAndPrivateNotesOrNotFound.tsx index 2c0edc77aad9..468e4264bb3c 100644 --- a/src/pages/home/report/withReportAndPrivateNotesOrNotFound.tsx +++ b/src/pages/home/report/withReportAndPrivateNotesOrNotFound.tsx @@ -40,7 +40,7 @@ export default function (pageTitle: TranslationPaths) { const isReconnecting = prevIsOffline && !isOffline; const isOtherUserNote = !!accountID && Number(session?.accountID) !== Number(accountID); const isPrivateNotesFetchFinished = isPrivateNotesFetchTriggered && !report.isLoadingPrivateNotes; - const isPrivateNotesEmpty = accountID ? !report?.privateNotes?.[Number(accountID)]?.note : isEmptyObject(report?.privateNotes); + const isPrivateNotesUndefined = accountID ? report?.privateNotes?.[Number(accountID)]?.note === undefined : isEmptyObject(report?.privateNotes); useEffect(() => { // Do not fetch private notes if isLoadingPrivateNotes is already defined, or if network is offline. @@ -62,13 +62,13 @@ export default function (pageTitle: TranslationPaths) { } // Don't show not found view if the notes are still loading, or if the notes are non-empty. - if (shouldShowFullScreenLoadingIndicator || !isPrivateNotesEmpty || isReconnecting) { + if (shouldShowFullScreenLoadingIndicator || !isPrivateNotesUndefined || isReconnecting) { return false; } // As notes being empty and not loading is a valid case, show not found view only in offline mode. return isOffline; - }, [report, isOtherUserNote, shouldShowFullScreenLoadingIndicator, isPrivateNotesEmpty, isReconnecting, isOffline]); + }, [report, isOtherUserNote, shouldShowFullScreenLoadingIndicator, isPrivateNotesUndefined, isReconnecting, isOffline]); if (shouldShowFullScreenLoadingIndicator) { return ;