Salesforce Decode
Salesforcedecode
Back to questions
LWCAdvancedperformancerenderingdatatable

Reduce LWC re-renders when passing large arrays to child datatable

Real World Scenario

Parent recreates 2000-row array reference every wire refresh causing child datatable full re-render and scroll position loss.

Expected Answer

• Mutate array in place with same reference when rows unchanged structurally • Compare row Id sets before replacing data reference • @track only primitive flags not entire row array when possible • Child datatable key field stable for row identity • Debounce wire updates coalescing rapid notify bursts • Paginate reducing array size passed to child • Profile render count in Chrome Performance during wire refresh

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Main difference: use case and scale. Mutate array in place with same reference when rows unchanged structurally. Compare row Id sets before replacing data reference. Pick based on your integration pattern and team capability. Reference churn causes invisible performance bugs—stabilize data references across wire refreshes. Optimize for scale and operational observability.

Architect Perspective

Reference churn causes invisible performance bugs—stabilize data references across wire refreshes.