Skip to content

Commit

Permalink
Merge pull request #50440 from Nodebrute/fixdeletedmessage
Browse files Browse the repository at this point in the history
fix deleted message not found page
  • Loading branch information
aldo-expensify authored Oct 15, 2024
2 parents 6a0042f + 266fd69 commit 7fca65b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,11 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro
!isCurrentReportLoadedFromOnyx ||
isLoading;

const isLinkedActionBecomesDeleted = prevIsLinkedActionDeleted !== undefined && !prevIsLinkedActionDeleted && isLinkedActionDeleted;

// eslint-disable-next-line rulesdir/no-negated-variables
const shouldShowNotFoundLinkedAction =
(!isLinkedActionInaccessibleWhisper && isLinkedActionDeleted && !!prevIsLinkedActionDeleted) ||
(!isLinkedActionInaccessibleWhisper && isLinkedActionDeleted && !isLinkedActionBecomesDeleted) ||
(shouldShowSkeleton &&
!reportMetadata.isLoadingInitialReportActions &&
!!reportActionIDFromRoute &&
Expand Down Expand Up @@ -661,12 +663,11 @@ function ReportScreen({route, currentReportID = '', navigation}: ReportScreenPro
useEffect(() => {
// If the linked action is previously available but now deleted,
// remove the reportActionID from the params to not link to the deleted action.
const isLinkedActionBecomesDeleted = prevIsLinkedActionDeleted !== undefined && !prevIsLinkedActionDeleted && isLinkedActionDeleted;
if (!isLinkedActionBecomesDeleted) {
return;
}
Navigation.setParams({reportActionID: ''});
}, [prevIsLinkedActionDeleted, isLinkedActionDeleted]);
}, [isLinkedActionBecomesDeleted]);

// If user redirects to an inaccessible whisper via a deeplink, on a report they have access to,
// then we set reportActionID as empty string, so we display them the report and not the "Not found page".
Expand Down

0 comments on commit 7fca65b

Please sign in to comment.