Error in console, when a list or record view contains invalid fields

Corteza Version: 2023.9.7

I removed some fields from a module, but still had a reference in the list page and a record page of another module. This creates the following error in the console. I would suggest to catch this error and show a error message to the user that a field reference is invalid (maybe even name the field if possible), so the user can fix it.

Record.vue:137 Uncaught (in promise) 
TypeError: Cannot read properties of undefined (reading 'kind')
    at Record.vue:137:1
    at (<anonymous>)
    at ye (chunk-b6a145b8.b3af3ecf.js:1:17814)
    at l (chunk-b6a145b8.b3af3ecf.js:1:18018)
    at chunk-b6a145b8.b3af3ecf.js:1:18079
    at new Promise (<anonymous>)
    at chunk-b6a145b8.b3af3ecf.js:1:17958
    at Record.vue:191:1

This line causes the issue if (relatedField.kind === 'Record' && recordLabelField) {

return this.findModuleByID({ namespace: this.namespace, moduleID }).then(async module => {
        const relatedField = module.fields.find(({ name }) => name === labelField)
        let records = this.findRecordsByIDs(recordIDs).map(r => new compose.Record(module, r))
        const mappedIDs = {}

        if (relatedField.kind === 'Record' && recordLabelField) {
          this.processing = true