fix(ui): prevent crashing when webhooks are loading
This commit is contained in:
parent
d19adbed44
commit
9614d12247
2 changed files with 9 additions and 1 deletions
|
|
@ -75,7 +75,7 @@ function Condition({
|
|||
placeholder="Select Condition"
|
||||
options={conditions}
|
||||
name="operator"
|
||||
defaultValue={instance.query.operator}
|
||||
value={conditions.find(c => c.value === instance.query.operator)}
|
||||
onChange={({ value }) =>
|
||||
writeQueryOption(null, { name: 'operator', value: value.value })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ const getThreshold = (threshold: number) => {
|
|||
};
|
||||
|
||||
const getNotifyChannel = (alert: Record<string, any>, webhooks: Array<any>) => {
|
||||
// @ts-ignore god damn you immutable
|
||||
if (webhooks.size === 0) {
|
||||
return 'OpenReplay';
|
||||
}
|
||||
const getSlackChannels = () => {
|
||||
return (
|
||||
' (' +
|
||||
|
|
@ -57,6 +61,10 @@ interface Props extends RouteComponentProps {
|
|||
function AlertListItem(props: Props) {
|
||||
const { alert, siteId, history, init, demo, webhooks } = props;
|
||||
|
||||
if (!alert) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const onItemClick = () => {
|
||||
if (demo) return;
|
||||
const path = withSiteId(alertEdit(alert.alertId), siteId);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue