
LWC Kept Showing Old Record Data Until I Stopped Using connectedCallback
You've built a dynamic data table in LWC. It pulls records via Apex, responds to a lookup field, and works perfectly on first load. Then a user navigates to a different record, the component re-renders — and the old data is still sitting there. You refresh. It updates. The bug is real but intermittent, and it makes no sense because you're not even using @AuraEnabled(cacheable=true) . The culprit, more often than not, is connectedCallback . This article walks through a reusable data table architecture I built recently, the cache issue I ran into, and why switching to @api setter methods fixed it. The Component Architecture The setup is two components: a parent that holds filter controls (a lookup field, search input, etc.) and a child that renders the table. The child is intentionally generic — swap the lookup reference and it returns different data. You can drop it anywhere. <!-- Parent: c-record-filter-form --> <template> <c-lookup-field onselect= {handleLookupSelect} ></c-lookup-fiel
Continue reading on Dev.to
Opens in a new tab



