From 331085dfb339c09f3fee4aa54d65b2a50dcf5d61 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 26 Oct 2025 09:20:32 +0000 Subject: [PATCH] Fix empty article content in edit mode by deferring editor initialization Co-authored-by: mroxso <24775431+mroxso@users.noreply.github.com> --- src/components/ProfessionalBlogPostForm.tsx | 29 ++++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/components/ProfessionalBlogPostForm.tsx b/src/components/ProfessionalBlogPostForm.tsx index 059669b..7d962c6 100644 --- a/src/components/ProfessionalBlogPostForm.tsx +++ b/src/components/ProfessionalBlogPostForm.tsx @@ -64,6 +64,7 @@ export function ProfessionalBlogPostForm({ editIdentifier }: ProfessionalBlogPos hashtags: '', }); const [showMetadata, setShowMetadata] = useState(true); + const [isEditorReady, setIsEditorReady] = useState(false); // Load existing post data when editing useEffect(() => { @@ -126,8 +127,15 @@ export function ProfessionalBlogPostForm({ editIdentifier }: ProfessionalBlogPos console.error('Failed to parse existing content:', error); } } + setIsEditorReady(true); + } else if (!editIdentifier) { + // In create mode, editor is ready immediately + setIsEditorReady(true); + } else if (editIdentifier && !isLoadingPost && !existingPost) { + // Post not found, but we should still allow rendering + setIsEditorReady(true); } - }, [existingPost, editIdentifier]); + }, [existingPost, editIdentifier, isLoadingPost]); const handleMetadataChange = (field: keyof typeof metadata, value: string) => { setMetadata(prev => ({ ...prev, [field]: value })); @@ -437,12 +445,19 @@ export function ProfessionalBlogPostForm({ editIdentifier }: ProfessionalBlogPos Content -
- setEditorState(value)} - /> -
+ {isEditorReady ? ( +
+ setEditorState(value)} + /> +
+ ) : ( +
+ +
+ )}

Write your article using the rich text editor. Markdown formatting is supported.