@@ -191,16 +191,23 @@ export abstract class UmbBlockEntryContext<
191191 this . #observeBlockTypeLabel( ) ;
192192 } ) ;
193193
194+ // Correct settings data, accordingly to configuration of the BlockType: [NL]
194195 this . observe (
195196 observeMultiple ( [ this . settingsElementTypeKey , this . settingsDataContentTypeKey ] ) ,
196197 ( [ settingsElementTypeKey , settingsDataContentTypeKey ] ) => {
198+ // Notice the values are only undefined while we are missing the source of these observables. [NL]
197199 if ( settingsElementTypeKey === undefined || settingsDataContentTypeKey === undefined ) return ;
198- if ( settingsElementTypeKey !== null && settingsElementTypeKey !== settingsDataContentTypeKey ) {
199- // Update the settings model with latest elementTypeKey, so data is up to date with configuration: [NL]
200- const currentSettings = this . #settings. getValue ( ) ;
201- if ( currentSettings ) {
202- this . _manager ?. setOneSettings ( { ...currentSettings , contentTypeKey : settingsElementTypeKey } ) ;
200+ // Is there a difference between configuration and actual data udi:
201+ if ( settingsElementTypeKey !== settingsDataContentTypeKey ) {
202+ // We need to update our udi for the settings data [NL]
203+ if ( settingsElementTypeKey != null ) {
204+ // Update the settings model with latest elementTypeKey, so data is up to date with configuration: [NL]
205+ const currentSettings = this . #settings. getValue ( ) ;
206+ if ( currentSettings ) {
207+ this . _manager ?. setOneSettings ( { ...currentSettings , contentTypeKey : settingsElementTypeKey } ) ;
208+ }
203209 }
210+ // We do not need to remove the settings if configuration is gone, cause another observation handles this. [NL]
204211 }
205212 } ,
206213 ) ;
0 commit comments