From a922d58d200dd48091d6a2e5ea1f1fe913155489 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Fri, 24 Jan 2020 11:11:26 -0500 Subject: [PATCH] Clear text field in state after posting in Compose --- src/pages/Compose.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/Compose.tsx b/src/pages/Compose.tsx index d455a03..cefddaa 100644 --- a/src/pages/Compose.tsx +++ b/src/pages/Compose.tsx @@ -626,9 +626,15 @@ class Composer extends Component { : null }) - // If we succeed, send a success message and go back. + // If we succeed, send a success message, clear the status + // text field, and go back. .then(() => { this.props.enqueueSnackbar("Posted!"); + + // This is necessary to prevent session drafts from saving + // posts that were already posted. + this.setState({ text: "" }); + window.history.back(); })