@@ -39,7 +39,7 @@ export const QueryBuilderPayloadSelect: ComponentType<PayloadSelectProps> = ({
39
39
if ( isArray ( currentOption ) ) {
40
40
for ( let index = 0 ; index < currentOption . length ; index ++ ) {
41
41
const foundOption = metrics . find ( ( item ) => item . value === currentOption [ index ] . value ) ;
42
- if ( foundOption ! == undefined ) {
42
+ if ( foundOption = == undefined ) {
43
43
metrics . push ( {
44
44
value : currentOption [ index ] . value ,
45
45
label : currentOption [ index ] . label ,
@@ -48,7 +48,7 @@ export const QueryBuilderPayloadSelect: ComponentType<PayloadSelectProps> = ({
48
48
}
49
49
} else if ( currentOption ) {
50
50
const foundOption = metrics . find ( ( item ) => item . value === currentOption . value ) ;
51
- if ( foundOption ! == undefined ) {
51
+ if ( foundOption = == undefined ) {
52
52
metrics . push ( { ...currentOption , value : currentOption . value , label : currentOption . label } ) ;
53
53
}
54
54
}
@@ -62,7 +62,7 @@ export const QueryBuilderPayloadSelect: ComponentType<PayloadSelectProps> = ({
62
62
throw new Error ( response . statusText ) ;
63
63
}
64
64
) ;
65
- } , [ datasource , query . payload , query . target ] ) ;
65
+ } , [ datasource , query . payload , query . target , currentOption ] ) ;
66
66
67
67
const getMetricPayloadOptions = React . useCallback ( ( ) => {
68
68
setIsPayloadOptionsLoading ( true ) ;
@@ -86,7 +86,7 @@ export const QueryBuilderPayloadSelect: ComponentType<PayloadSelectProps> = ({
86
86
if ( value ) {
87
87
if ( isArray ( value ) ) {
88
88
const foundOptions = payloadOptions . filter ( ( item ) => includes ( value , item . value ) ) ;
89
- if ( foundOptions ) {
89
+ if ( foundOptions . length > 0 ) {
90
90
setCurrentOption ( foundOptions ) ;
91
91
} else if ( value ) {
92
92
setCurrentOption ( [ { label : value , value : value } ] ) ;
0 commit comments