Skip to content

Commit

Permalink
fix empty string in selected indices
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Sep 7, 2020
1 parent 19bf9ed commit b84c8ae
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const IndicesAndDataStreamsField: FunctionComponent<Props> = ({

// We assume all indices if the config has no indices entry or if we receive an empty array
const [isAllIndices, setIsAllIndices] = useState<boolean>(
!config.indices || (Array.isArray(config.indices) && config.indices.length === 0)
config.indices == null || (Array.isArray(config.indices) && config.indices.length === 0)
);

const onUpdate = (data: IndicesConfig) => {
Expand Down Expand Up @@ -135,12 +135,17 @@ export const IndicesAndDataStreamsField: FunctionComponent<Props> = ({
);
onUpdate({ indices: undefined });
} else {
onUpdate({
indices:
selectIndicesMode === 'custom'
? indexPatterns.join(',')
: [...(indicesAndDataStreamsSelection || [])],
});
_onUpdate(
{
indices:
selectIndicesMode === 'custom'
? indexPatterns.join(',')
: [...(indicesAndDataStreamsSelection || [])],
},
{
validateIndicesCount: true,
}
);
}
}}
/>
Expand Down

0 comments on commit b84c8ae

Please sign in to comment.