From 36be728a5440d869e1562b57c2ea0a9afb310139 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Mon, 9 Jan 2023 17:56:14 +0100 Subject: [PATCH] change(ui): add observer --- .../Dashboard/components/Alerts/AlertForm/NotifyHooks.tsx | 3 ++- .../app/components/Dashboard/components/Alerts/NewAlert.tsx | 2 +- frontend/app/mstore/alertsStore.ts | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/app/components/Dashboard/components/Alerts/AlertForm/NotifyHooks.tsx b/frontend/app/components/Dashboard/components/Alerts/AlertForm/NotifyHooks.tsx index 15f00a0a3..95efaaaf3 100644 --- a/frontend/app/components/Dashboard/components/Alerts/AlertForm/NotifyHooks.tsx +++ b/frontend/app/components/Dashboard/components/Alerts/AlertForm/NotifyHooks.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { Checkbox } from 'UI'; import DropdownChips from '../DropdownChips'; +import { observer } from 'mobx-react-lite' interface INotifyHooks { instance: Alert; @@ -128,4 +129,4 @@ function NotifyHooks({ ); } -export default NotifyHooks; +export default observer(NotifyHooks); diff --git a/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx b/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx index aa6c18714..258b550cd 100644 --- a/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx +++ b/frontend/app/components/Dashboard/components/Alerts/NewAlert.tsx @@ -88,7 +88,7 @@ const NewAlert = (props: IProps) => { init({}); if (list.length === 0) fetchList(); fetchTriggerOptions(); - fetchWebhooks(); + void fetchWebhooks(); }, []); useEffect(() => { diff --git a/frontend/app/mstore/alertsStore.ts b/frontend/app/mstore/alertsStore.ts index da83610c6..d377af81e 100644 --- a/frontend/app/mstore/alertsStore.ts +++ b/frontend/app/mstore/alertsStore.ts @@ -71,7 +71,10 @@ export default class AlertsStore { edit = (diff: Partial) => { const key = Object.keys(diff)[0] + const oldInst = this.instance // @ts-ignore - this.instance[key] = diff[key] + oldInst[key] = diff[key] + + this.instance = oldInst } }