@@ -39,7 +39,7 @@ export const QueryBuilderPayloadSelect: ComponentType<PayloadSelectProps> = ({
3939 if ( isArray ( currentOption ) ) {
4040 for ( let index = 0 ; index < currentOption . length ; index ++ ) {
4141 const foundOption = metrics . find ( ( item ) => item . value === currentOption [ index ] . value ) ;
42- if ( foundOption ! == undefined ) {
42+ if ( foundOption = == undefined ) {
4343 metrics . push ( {
4444 value : currentOption [ index ] . value ,
4545 label : currentOption [ index ] . label ,
@@ -48,7 +48,7 @@ export const QueryBuilderPayloadSelect: ComponentType<PayloadSelectProps> = ({
4848 }
4949 } else if ( currentOption ) {
5050 const foundOption = metrics . find ( ( item ) => item . value === currentOption . value ) ;
51- if ( foundOption ! == undefined ) {
51+ if ( foundOption = == undefined ) {
5252 metrics . push ( { ...currentOption , value : currentOption . value , label : currentOption . label } ) ;
5353 }
5454 }
@@ -62,7 +62,7 @@ export const QueryBuilderPayloadSelect: ComponentType<PayloadSelectProps> = ({
6262 throw new Error ( response . statusText ) ;
6363 }
6464 ) ;
65- } , [ datasource , query . payload , query . target ] ) ;
65+ } , [ datasource , query . payload , query . target , currentOption ] ) ;
6666
6767 const getMetricPayloadOptions = React . useCallback ( ( ) => {
6868 setIsPayloadOptionsLoading ( true ) ;
@@ -86,7 +86,7 @@ export const QueryBuilderPayloadSelect: ComponentType<PayloadSelectProps> = ({
8686 if ( value ) {
8787 if ( isArray ( value ) ) {
8888 const foundOptions = payloadOptions . filter ( ( item ) => includes ( value , item . value ) ) ;
89- if ( foundOptions ) {
89+ if ( foundOptions . length > 0 ) {
9090 setCurrentOption ( foundOptions ) ;
9191 } else if ( value ) {
9292 setCurrentOption ( [ { label : value , value : value } ] ) ;
0 commit comments