From: Dessalines Date: Fri, 17 Feb 2023 02:10:03 +0000 (-0500) Subject: Fix issue with empty markdown content not nulling DB. Fixes #924 (#925) X-Git-Url: http://these/git/%24%7B%60data:application/static/%7Bthis.props.icon%7D?a=commitdiff_plain;h=deffaf1ee0eaf5ca6af40642f5c30bd998f5036b;p=lemmy-ui.git 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 --- diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index 9b51a7e..48b9042 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) {