Salesforce Decode
Salesforcedecode
Back to questions
LWCExpertvirtual-scrollperformancelarge-lists

Implement virtual scrolling for 10k row LWC list without crushing DOM

Real World Scenario

Operations dashboard must display 10,000 work order rows with sort and filter; initial lightning-datatable implementation freezes browser.

Expected Answer

• Server-side pagination and sort mandatory — never load 10k rows to client • Virtual scroll renders only visible window plus buffer rows • Debounce filter input 300ms before Apex query • Use @wire with pageToken cursor not offset for stable pagination • Show total count separately without rendering all rows • Measure INP and LCP on low-end devices in field test • Consider report or Einstein Analytics for true large dataset exploration

Follow-Up Questions & Answers

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

Direct answer: Server-side pagination and sort mandatory — never load 10k rows to client Also consider: Virtual scroll renders only visible window plus buffer rows In practice: Debounce filter input 300ms before Apex query Validate against production-scale constraints and long-term platform evolution.

Architect Perspective

10k rows in browser is always an architecture failure — push data volume to server or analytics layer.