change(ui): add observer

This commit is contained in:
nick-delirium 2023-01-09 17:56:14 +01:00 committed by Delirium
parent 8d7d183041
commit 36be728a54
3 changed files with 7 additions and 3 deletions

View file

@ -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);

View file

@ -88,7 +88,7 @@ const NewAlert = (props: IProps) => {
init({});
if (list.length === 0) fetchList();
fetchTriggerOptions();
fetchWebhooks();
void fetchWebhooks();
}, []);
useEffect(() => {

View file

@ -71,7 +71,10 @@ export default class AlertsStore {
edit = (diff: Partial<Alert>) => {
const key = Object.keys(diff)[0]
const oldInst = this.instance
// @ts-ignore
this.instance[key] = diff[key]
oldInst[key] = diff[key]
this.instance = oldInst
}
}