LWCIntermediateldscacheimperative
Refresh LDS cache after imperative Apex updates sibling LWCs on record page
Real World Scenario
Custom LWC saves Opportunity line items via imperative Apex but standard header and related list LWCs show stale amounts until hard refresh.
Expected Answer
• Call getRecordNotifyChange with updated record IDs after successful Apex DML
• updateRecord from uiRecordApi for single-record field updates triggering LDS refresh
• notifyRecordUpdateAvailable for legacy refresh patterns where applicable
• Wire siblings on same record auto-refresh when LDS cache invalidated
• Avoid duplicate Apex fetch in saver LWC—return updated fields from save response
• Test refresh: assert wire data updates without page reload in Jest mock
• Document which components depend on LDS vs custom Apex cache
Follow-Up Questions & Answers
Click to expand — each follow-up includes a direct, interview-ready answer
Main difference: use case and scale. Call getRecordNotifyChange with updated record IDs after successful Apex DML. updateRecord from uiRecordApi for single-record field updates triggering LDS refresh. Pick based on your integration pattern and team capability. Imperative save without LDS notification breaks record page cohesion—notify is mandatory integration step. Balance speed of delivery with maintainability.
Architect Perspective
Imperative save without LDS notification breaks record page cohesion—notify is mandatory integration step.