[SalesForce] Uncaught (in promise) TypeError: Cannot read property ‘Symbol(ViewModel)’ of undefined

[updated to include debug error log] I have two Lightning Web Components, one with a set of data rows in a repeat table, and one with an form with fields for an individual record. Both are contained in a third container component.

When the user selects a row in the table (using a radio), the onclick dispatches an event ("selected"). That event is trapped by the container component ( onselected={handleSelected} ) and updates a property called contactId. That change is reflected in the other child component, which is using $contactId syntax to track updates to the container component's property.

This was all working fine, but has suddenly started throwing an error that seems opaque and un-debuggable. I have undone all recent changes in an attempt to identify the cause, to no avail.

The error is this :

aura_proddebug.js:274 Uncaught (in promise) TypeError: Cannot read property 'Symbol(ViewModel)' of undefined
at getInternalField (aura_proddebug.js:274)
at Object.update (aura_proddebug.js:1793)
at updateCustomElmDefaultHook (aura_proddebug.js:5627)
at Object.update (aura_proddebug.js:5779)
at patchVnode (aura_proddebug.js:5021)
at updateStaticChildren (aura_proddebug.js:5000)
at aura_proddebug.js:5542
at runWithBoundaryProtection (aura_proddebug.js:8255)
at updateChildrenHook (aura_proddebug.js:5541)
at Object.update (aura_proddebug.js:5751)

The error is thrown after handleSelected() has updated the value of contactId. That update works correctly but everything stops at that point and the form does not re-render.

handleSelected(event) {
  this.contactId = event.detail && (event.detail != '0') ? event.detail : undefined;
  console.log('ContactId Updated : ' + this.contactId);
  ==> error thrown after this line of code. The console.log is successful.  
}

Does anyone have an idea what this might be, where to look for potential problems and how I might go about debugging it ?

Best Answer

I just got the same error, and in my component, I was missing the public property in my class.

Make sure you have @api contactId in your class.