From df836a9b6de73b0a71f815f1ac38740301b8ca63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Fri, 27 Dec 2024 15:45:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A6=E6=9D=9F=E5=8F=AF=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E4=B8=8D=E5=8F=AF=E4=B8=BA=E7=A9=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/EditableTitle.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/EditableTitle.tsx b/src/components/EditableTitle.tsx index dc59adf..b46ef9f 100644 --- a/src/components/EditableTitle.tsx +++ b/src/components/EditableTitle.tsx @@ -1,4 +1,5 @@ import { Icon } from '@iconify/react/dist/iconify.js'; +import { isEmpty } from 'lodash-es'; import { useRef, useState } from 'react'; import styles from './EditableTitle.module.css'; @@ -16,7 +17,7 @@ export function EditableTitle({ title, onChange }: EditableTitleProps) { }; const handleSubmit = (data: FormData) => { const newTitle = data.get('title') as string; - if (newTitle !== title && onChange) { + if (!isEmpty(newTitle) && newTitle !== title) { onChange?.(newTitle); } cancelEdit();