@@ -33,7 +33,7 @@ export interface ContainerProps extends WrapperProps, DropdownProps {
3333export interface ContainerState {
3434 isClearable : boolean ;
3535 options : ReferenceOption [ ] ;
36- selected : any ;
36+ selected : ReferenceOption [ ] | any ;
3737}
3838
3939class DropdownReferenceSetContainer extends Component < ContainerProps , ContainerState > {
@@ -45,7 +45,6 @@ class DropdownReferenceSetContainer extends Component<ContainerProps, ContainerS
4545
4646 private subscriptionHandles : number [ ] = [ ] ;
4747 private association : string = this . props . entityPath . split ( "/" ) [ 0 ] ;
48- private readonly handleOnClick : ( selectedOption : ReferenceOption | any ) => void = this . onChange . bind ( this ) ;
4948
5049 render ( ) {
5150 return createElement ( DropdownReferenceSet , {
@@ -54,7 +53,7 @@ class DropdownReferenceSetContainer extends Component<ContainerProps, ContainerS
5453 data : this . state . options ,
5554 asyncData : this . setAsyncOptions ,
5655 emptyOptionCaption : this . props . emptyOptionCaption ,
57- handleOnchange : this . handleOnClick ,
56+ handleOnchange : this . onChange ,
5857 isClearable : this . props . isClearable ,
5958 selectType : this . props . selectType ,
6059 lazyFilter : this . props . lazyFilter ,
@@ -74,7 +73,7 @@ class DropdownReferenceSetContainer extends Component<ContainerProps, ContainerS
7473 }
7574
7675 componentWillReceiveProps ( newProps : ContainerProps ) {
77- if ( newProps . mxObject !== this . props . mxObject ) {
76+ if ( newProps . mxObject && newProps . mxObject !== this . props . mxObject ) {
7877 const selected = newProps . mxObject . get ( this . association ) ;
7978 this . getSelectedValues ( newProps ) ;
8079 this . resetSubscriptions ( newProps . mxObject ) ;
@@ -130,7 +129,7 @@ class DropdownReferenceSetContainer extends Component<ContainerProps, ContainerS
130129 }
131130 }
132131
133- private onChange ( recentSelection : ReferenceOption [ ] ) {
132+ private onChange = ( recentSelection : ReferenceOption [ ] | any ) => {
134133 if ( this . props . mxObject ) {
135134 const selectedOptions : string [ ] = [ ] ;
136135
@@ -245,9 +244,6 @@ class DropdownReferenceSetContainer extends Component<ContainerProps, ContainerS
245244 if ( input && input . length >= this . props . minimumCharacter ) {
246245 return this . retrieveOptions ( this . props , input )
247246 . then ( ( ) => Promise . resolve ( { options : this . state . options } ) ) ;
248- } else {
249- return this . getSelectedValues ( this . props )
250- . then ( ( ) => Promise . resolve ( { options : [ ] } ) ) ;
251247 }
252248 }
253249
0 commit comments