From 36f3edc477d87e97390423eec7bfeece46947c49 Mon Sep 17 00:00:00 2001 From: Peter Holmberg Date: Thu, 8 Oct 2020 15:17:27 +0200 Subject: [PATCH] Fix: Ensure Notification types loaded before loading notification channel (#28115) --- .../features/alerting/EditNotificationChannelPage.tsx | 10 +--------- public/app/features/alerting/state/actions.ts | 1 + 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/public/app/features/alerting/EditNotificationChannelPage.tsx b/public/app/features/alerting/EditNotificationChannelPage.tsx index 1f92cb44839..efa6b1ca4b9 100644 --- a/public/app/features/alerting/EditNotificationChannelPage.tsx +++ b/public/app/features/alerting/EditNotificationChannelPage.tsx @@ -6,12 +6,7 @@ import { Form, Spinner } from '@grafana/ui'; import Page from 'app/core/components/Page/Page'; import { connectWithCleanUp } from 'app/core/components/connectWithCleanUp'; import { NotificationChannelForm } from './components/NotificationChannelForm'; -import { - loadNotificationChannel, - loadNotificationTypes, - testNotificationChannel, - updateNotificationChannel, -} from './state/actions'; +import { loadNotificationChannel, testNotificationChannel, updateNotificationChannel } from './state/actions'; import { getNavModel } from 'app/core/selectors/navModel'; import { getRouteParamsId } from 'app/core/selectors/location'; import { mapChannelsToSelectableValue, transformSubmitData, transformTestData } from './utils/notificationChannels'; @@ -28,7 +23,6 @@ interface ConnectedProps { } interface DispatchProps { - loadNotificationTypes: typeof loadNotificationTypes; loadNotificationChannel: typeof loadNotificationChannel; testNotificationChannel: typeof testNotificationChannel; updateNotificationChannel: typeof updateNotificationChannel; @@ -41,7 +35,6 @@ export class EditNotificationChannelPage extends PureComponent { componentDidMount() { const { channelId } = this.props; - this.props.loadNotificationTypes(); this.props.loadNotificationChannel(channelId); } @@ -136,7 +129,6 @@ const mapStateToProps: MapStateToProps = s }; const mapDispatchToProps: MapDispatchToProps = { - loadNotificationTypes, loadNotificationChannel, testNotificationChannel, updateNotificationChannel, diff --git a/public/app/features/alerting/state/actions.ts b/public/app/features/alerting/state/actions.ts index 390c2f89e6a..d6bc95e060d 100644 --- a/public/app/features/alerting/state/actions.ts +++ b/public/app/features/alerting/state/actions.ts @@ -69,6 +69,7 @@ export function loadNotificationTypes(): ThunkResult { export function loadNotificationChannel(id: number): ThunkResult { return async dispatch => { + await dispatch(loadNotificationTypes()); const notificationChannel = await getBackendSrv().get(`/api/alert-notifications/${id}`); dispatch(notificationChannelLoaded(notificationChannel)); };