Skip to content

Commit 6b86334

Browse files
committed
docs: explain implementation changes
1 parent d3d18de commit 6b86334

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/components/MoneyRequestHeader.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, backTo, onBackB
7575
const route = useRoute();
7676
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`, {
7777
canBeMissing: false,
78+
// We need to use a selector here to prevent the component from re-rendering on unused report properties changes
7879
selector: (onyxReport) =>
7980
onyxReport && {
8081
reportID: onyxReport.reportID,
@@ -90,6 +91,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, backTo, onBackB
9091
}`,
9192
{
9293
canBeMissing: true,
94+
// We need to use a selector here to prevent the component from re-rendering on unused transaction properties changes
9395
selector: (onyxTransaction) =>
9496
onyxTransaction && {
9597
transactionID: onyxTransaction.transactionID,

src/pages/home/ReportScreen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
219219
*/
220220
const report = useMemo(
221221
() =>
222+
// This is required to get the transaction data from the parent report, to render the optimistic transaction thread
222223
parentReportIDFromRoute && parentReportActionIDFromRoute
223224
? ({
224225
...reportOnyx,

0 commit comments

Comments
 (0)