From 48a8e9f6a97f584b76f5ef426751932c22bcb7d7 Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Wed, 23 Mar 2022 15:40:47 -0700 Subject: [PATCH] client: fix hydration error with placeholder for post title --- client/components/edit-document/index.tsx | 4 ++-- client/components/new-post/title/index.tsx | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/client/components/edit-document/index.tsx b/client/components/edit-document/index.tsx index 4d6ab562..0bd2ff19 100644 --- a/client/components/edit-document/index.tsx +++ b/client/components/edit-document/index.tsx @@ -82,7 +82,7 @@ const Document = ({ remove, title, content, setTitle, setContent, initialTab = ' if (skeleton) { return <> - +
{remove && } @@ -98,7 +98,7 @@ const Document = ({ remove, title, content, setTitle, setContent, initialTab = ' return ( <> - +
{ + const [placeholder, setPlaceholder] = useState(titlePlaceholders[0]) + useEffect(() => { + // set random placeholder on load + setPlaceholder(titlePlaceholders[Math.floor(Math.random() * titlePlaceholders.length)]) + }, []) return (
Drift