Coding tips
TypeError: Cannot read properties of undefined (reading 'x') in JavaScript: 10 Causes and Fixes (Tested Examples)
"Cannot read properties of undefined (reading 'x')" means the thing before the dot is undefined, not that x is missing. Find which value is undefined, then fix the cause: data not loaded yet, a missing return, a typo in a key, an array index past the end, or a lost this.