Skip to content

Commit

Permalink
fix empty string in selected indices (#76855)
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens authored Sep 8, 2020
1 parent 219d0b5 commit eecb0e5
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 eecb0e5

Please sign in to comment.