From 1cad816b173b1e2833b3912ea0cfff990ca3903f Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Tue, 17 Dec 2024 19:15:05 +0800 Subject: [PATCH] fix: render error when notify template is empty --- ui/src/components/notify/NotifyTemplate.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/src/components/notify/NotifyTemplate.tsx b/ui/src/components/notify/NotifyTemplate.tsx index 1ca6bd63..03d3a433 100644 --- a/ui/src/components/notify/NotifyTemplate.tsx +++ b/ui/src/components/notify/NotifyTemplate.tsx @@ -28,7 +28,7 @@ const NotifyTemplate = () => { }, []); const handleTitleChange = (val: string) => { - const template = templates[0]; + const template = templates?.[0] ?? {}; setTemplates([ { @@ -39,7 +39,7 @@ const NotifyTemplate = () => { }; const handleContentChange = (val: string) => { - const template = templates[0]; + const template = templates?.[0] ?? {}; setTemplates([ { @@ -71,7 +71,7 @@ const NotifyTemplate = () => { return (
{ handleTitleChange(e.target.value); }} @@ -81,7 +81,7 @@ const NotifyTemplate = () => {