Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix paid system message is not highlighted when clicking on the message link #44719

Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,13 @@ function ReportScreen({
if (!sortedAllReportActions.length) {
return [];
}

return PaginationUtils.getContinuousChain(sortedAllReportActions, reportActionPages ?? [], (reportAction) => reportAction.reportActionID, reportActionIDFromRoute);
}, [reportActionIDFromRoute, sortedAllReportActions, reportActionPages]);
const linkedAction = useMemo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we introduce linkedAction here, should we update isLinkedMessageAvailable to use linkedAction instead? They have similar logic.

const isLinkedMessageAvailable = !!linkedAction; // Boolean(linkedAction)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's updated from main. I just merged it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. All good!

() => sortedAllReportActions.find((obj) => String(obj.reportActionID) === String(reportActionIDFromRoute)),
[reportActionIDFromRoute, sortedAllReportActions],
);

// Define here because reportActions are recalculated before mount, allowing data to display faster than useEffect can trigger.
// If we have cached reportActions, they will be shown immediately.
Expand Down Expand Up @@ -385,11 +390,11 @@ function ReportScreen({
}

useEffect(() => {
if (!transactionThreadReportID || !route?.params?.reportActionID) {
if (!transactionThreadReportID || !route?.params?.reportActionID || !ReportUtils.isOneTransactionThread(linkedAction?.childReportID ?? '-1', report.reportID, linkedAction)) {
return;
}
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(route?.params?.reportID));
}, [transactionThreadReportID, route?.params?.reportActionID, route?.params?.reportID]);
}, [transactionThreadReportID, route?.params?.reportActionID, route?.params?.reportID, linkedAction, report.reportID]);

if (ReportUtils.isMoneyRequestReport(report) || ReportUtils.isInvoiceReport(report)) {
headerView = (
Expand Down
Loading