@@ -55,17 +55,17 @@ export class DatabaseSingleSelectionSelector<T extends string | Big, R extends E
55
55
valueSourceAttribute
56
56
} = extractDatabaseProps ( props ) ;
57
57
58
+ if ( ds . status === "loading" && ( ! lazyLoading || ds . limit !== Infinity ) ) {
59
+ return ;
60
+ }
61
+
58
62
this . _attr = targetAttribute as R ;
59
63
this . readOnly = getReadonly ( targetAttribute , props . customEditability , props . customEditabilityExpression ) ;
60
64
this . lazyLoader . updateProps ( ds ) ;
61
65
this . lazyLoader . setLimit (
62
66
this . lazyLoader . getLimit ( ds . limit , this . readOnly , targetAttribute ?. status ?? ds . status , lazyLoading )
63
67
) ;
64
68
65
- if ( ds . status === "loading" ) {
66
- return ;
67
- }
68
-
69
69
this . caption . updateProps ( {
70
70
emptyOptionText : emptyOption ,
71
71
formattingAttributeOrExpression : captionProvider ,
@@ -101,9 +101,18 @@ export class DatabaseSingleSelectionSelector<T extends string | Big, R extends E
101
101
} ) ;
102
102
if ( obj ) {
103
103
this . currentId = obj ;
104
+ } else {
105
+ // NOTE: should not hit this scope normally
106
+ // if the value is not in the options list, but there is a value from attribute
107
+ // there is probably a mismatch between the value and the datasource
108
+ // logical next step is to try to reload the attribute value
109
+ // this.options.loadSelectedValue(targetAttribute.value?.toString(), valueSourceAttribute?.id);
104
110
}
105
111
} else {
106
- this . options . loadSelectedValue ( targetAttribute . value ?. toString ( ) ) ;
112
+ // should hit on initial condition whereas:
113
+ // no options are loaded yet : (allOptions.length > 0)
114
+ // but there is a value from target attribute : (!this.currentId)
115
+ this . options . loadSelectedValue ( targetAttribute . value ?. toString ( ) , valueSourceAttribute ?. id ) ;
107
116
}
108
117
} else if ( ! targetAttribute . value && this . currentId ) {
109
118
this . currentId = null ;
0 commit comments