Skip to content

Commit

Permalink
Merge pull request #40166 from abzokhattab/fix-notes-not-here-page
Browse files Browse the repository at this point in the history
Fixing not here page in empty notes
  • Loading branch information
Gonals authored Apr 16, 2024
2 parents e994e69 + f0e5209 commit ed7029b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pages/home/report/withReportAndPrivateNotesOrNotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 <LoadingPage title={translate(pageTitle)} />;
Expand Down

0 comments on commit ed7029b

Please sign in to comment.