fix(post): preserve content when signing or publishing

Critical fix: Don't clear editor content until publish succeeds.

**The Problem:**
- RichEditor automatically cleared content on submit
- Content was wiped immediately when clicking "Publish"
- User lost their content before knowing if publish succeeded

**The Solution:**
- Remove automatic `clearContent()` from RichEditor's handleSubmit
- Let PostViewer control when to clear the editor
- Only clear editor after successful publish (successCount > 0)

**User Experience Now:**
- Click "Publish" → content stays visible while publishing
- Publishing succeeds → content clears, show preview
- Publishing fails → content stays, user can edit and retry
- User rejects signing → content stays, can try again

No more losing your post to a rejected signature or failed publish!
This commit is contained in:
Claude
2026-01-21 11:52:09 +00:00
parent 673d90c972
commit 2dabd3b804
2 changed files with 4 additions and 1 deletions

View File

@@ -503,6 +503,9 @@ export function PostViewer({ windowId }: PostViewerProps = {}) {
localStorage.removeItem(draftKey);
}
// Clear editor content
editorRef.current?.clear();
// Show published preview
setShowPublishedPreview(true);

View File

@@ -402,7 +402,7 @@ export const RichEditor = forwardRef<RichEditorHandle, RichEditorProps>(
serialized.eventRefs,
serialized.addressRefs,
);
editorInstance.commands.clearContent();
// Don't clear content here - let the parent component decide when to clear
}
},
[onSubmit],