From eaffebb53c364eb9467df71560e204489a6637a5 Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Tue, 22 Mar 2022 20:16:24 -0700 Subject: [PATCH] client: optimize fetching rendered markdown --- client/components/document/index.tsx | 5 +++-- client/components/new-post/index.tsx | 2 +- client/components/preview/index.tsx | 6 ++++-- client/pages/api/render-markdown.ts | 4 +++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/client/components/document/index.tsx b/client/components/document/index.tsx index d8200c86..415e31fa 100644 --- a/client/components/document/index.tsx +++ b/client/components/document/index.tsx @@ -68,7 +68,8 @@ const Document = ({ remove, editable, title, content, setTitle, setContent, init const onTitleChange = useCallback((event: ChangeEvent) => setTitle ? setTitle(event.target.value) : null, [setTitle]) - const removeFile = useCallback(() => (remove?: () => void) => { + const removeFile = useCallback((remove?: () => void) => { + console.log(remove) if (remove) { if (content && content.trim().length > 0) { const confirmed = window.confirm("Are you sure you want to remove this file?") @@ -121,7 +122,7 @@ const Document = ({ remove, editable, title, content, setTitle, setContent, init width={"100%"} id={title} /> - {remove && editable &&