From 266848e6b2d0dcf47de685c00473e7eb20c9e17c Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Mon, 21 Mar 2022 19:14:40 -0700 Subject: [PATCH] client: fix uploading files when no files are present --- client/components/new-post/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/new-post/index.tsx b/client/components/new-post/index.tsx index 4c68c504..d042976b 100644 --- a/client/components/new-post/index.tsx +++ b/client/components/new-post/index.tsx @@ -88,7 +88,7 @@ const Post = () => { const uploadDocs = useCallback((files: DocumentType[]) => { // if no title is set and the only document is empty, - const isFirstDocEmpty = docs.length <= 1 && docs[0].title === '' && docs[0].content === '' + const isFirstDocEmpty = docs.length <= 1 && (docs.length ? docs[0].title === '' : true) const shouldSetTitle = !title && isFirstDocEmpty if (shouldSetTitle) { if (files.length === 1) {