From deffaf1ee0eaf5ca6af40642f5c30bd998f5036b Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 16 Feb 2023 21:10:03 -0500 Subject: [PATCH] Fix issue with empty markdown content not nulling DB. Fixes #924 (#925) * Fix issue with empty markdown content not nulling DB. Fixes #924 * Better syntax --- src/shared/components/common/markdown-textarea.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index 9b51a7eb..48b90428 100644 --- a/src/shared/components/common/markdown-textarea.tsx +++ b/src/shared/components/common/markdown-textarea.tsx @@ -390,9 +390,9 @@ export class MarkdownTextArea extends Component< } contentChange() { - if (this.state.content) { - this.props.onContentChange?.(this.state.content); - } + // Coerces the undefineds to empty strings, for replacing in the DB + let content = this.state.content ?? ""; + this.props.onContentChange?.(content); } handleContentChange(i: MarkdownTextArea, event: any) {