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