Skip to content

Commit c23f62e

Browse files
authored
Merge pull request Expensify#65570 from callstack-internal/perf/optimize-chat-bubble-cell-rendering
Render ChatBubbleCell only if it's needed
2 parents dee85ef + a67eb54 commit c23f62e

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/components/TransactionItemRow/index.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,10 @@ function TransactionItemRow({
388388
],
389389
);
390390
const safeColumnWrapperStyle = columnWrapperStyles ?? [styles.p3, styles.expenseWidgetRadius];
391+
const shouldRenderChatBubbleCell = useMemo(() => {
392+
return columns?.includes(CONST.REPORT.TRANSACTION_LIST.COLUMNS.COMMENTS) ?? false;
393+
}, [columns]);
394+
391395
return (
392396
<View
393397
style={[styles.flex1]}
@@ -479,11 +483,13 @@ function TransactionItemRow({
479483
missingFieldError={missingFieldError}
480484
/>
481485
</View>
482-
<ChatBubbleCell
483-
transaction={transactionItem}
484-
containerStyles={[styles.mt2]}
485-
isInSingleTransactionReport={isInSingleTransactionReport}
486-
/>
486+
{shouldRenderChatBubbleCell && (
487+
<ChatBubbleCell
488+
transaction={transactionItem}
489+
containerStyles={[styles.mt2]}
490+
isInSingleTransactionReport={isInSingleTransactionReport}
491+
/>
492+
)}
487493
</View>
488494
</View>
489495
</Animated.View>

0 commit comments

Comments
 (0)