Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose: Clear draft ID when the content is cleared.

nirvedh-harpal02100e5919b1
diff --git a/web/src/drafts.ts b/web/src/drafts.ts
index 2c9bed7e16a..7fae0a6a36c 100644
--- a/web/src/drafts.ts
+++ b/web/src/drafts.ts
@@ -444,10 +444,12 @@ export let update_draft = (opts: UpdateDraftOptions = {}): string | undefined =>
if (draft === undefined) {
// The user cleared the compose box, which means
- // there is nothing to save here but delete the
- // draft if exists.
+ // there is nothing to save here. Delete any existing draft
+ // and reset the draft id so the next attempt will create
+ // a fresh draft.
if (draft_id) {
draft_model.deleteDrafts([draft_id]);
+ compose_draft_id = undefined;
}
return undefined;
}