# Direct message draft is lost when page is refreshed

**URL:** https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515
**Category:** Bug
**Created:** [November 4, 2019, 5:51am UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515 "2019-11-04T05:51:09Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![strangecosmos](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/strangecosmos/32/197291_2.png) [@strangecosmos](https://meta.discourse.org/u/strangecosmos)
#### Post date: [November 4, 2019, 5:51am UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/1 "2019-11-04T05:51:09Z")

</div>

I just lost a direct message I spent 2 hours writing because the page refreshed and the draft was lost. I don’t think this happens with topics (I just tested it and it didn’t), but it’s happened to me more than once with messages.

On iPhone, I accidentally refresh the page because I try to scroll up while previewing my message and that gesture refreshes the page. Try it to see what I mean.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [November 4, 2019, 6:10am UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/2 "2019-11-04T06:10:56Z")

</div>

> [@strangecosmos](#):
>
> On iPhone, I accidentally refresh the page because I try to scroll up while previewing my message and that gesture refreshes the page. Try it to see what I mean.

Are you using the Discourse Hub app? Does this happen in Mobile Safari?

---

<div class="post-metadata">

### Author: ![strangecosmos](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/strangecosmos/32/197291_2.png) [@strangecosmos](https://meta.discourse.org/u/strangecosmos)
#### Post date: [November 4, 2019, 7:22am UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/3 "2019-11-04T07:22:03Z")

</div>

I’m using Chrome for iPhone. I just tried it on mobile Safari and it doesn’t appear that Safari has the same page refresh gesture.

Also, on mobile Safari, Discourse appears to save message drafts! 😮

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 4, 2019, 11:54pm UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/4 "2019-11-04T23:54:40Z")

</div>

> [@strangecosmos](#):
>
> I just lost a direct message I spent 2 hours writing because the page refreshed and the draft was lost.

What version of Discourse are you on? I fixed a lot of issues with drafts over the past few weeks. I highly recommend upgrading to latest.

Can you update to latest and reproduce this issue?

---

<div class="post-metadata">

### Author: ![strangecosmos](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/strangecosmos/32/197291_2.png) [@strangecosmos](https://meta.discourse.org/u/strangecosmos)
#### Post date: [November 5, 2019, 12:20am UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/5 "2019-11-05T00:20:01Z")

</div>

I was already on the latest when the issue occurred: 2.4.0.beta6

I was just able to reproduce the issue. Strangely, message drafts saved in one message thread I tested but not in the thread where I originally had the problem. Hm.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 5, 2019, 12:38am UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/6 "2019-11-05T00:38:34Z")

</div>

> [@strangecosmos](#):
>
> I was just able to reproduce the issue.

What are the steps? Can you repro on meta? Are you 100% sure this is not in your drafts section in your profile?

---

<div class="post-metadata">

### Author: ![strangecosmos](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/strangecosmos/32/197291_2.png) [@strangecosmos](https://meta.discourse.org/u/strangecosmos)
#### Post date: [November 5, 2019, 1:16am UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/7 "2019-11-05T01:16:50Z")

</div>

Yes, it isn’t in my drafts. I just checked.

Oddly, I was able to reproduce the issue earlier but now the draft saves successly (in the same message thread where I reproduced it). 😕

I can’t discern what might be causing the draft to save sometimes and not other times. As far as I can tell, I’m doing exactly the same thing: tapping my profile picture, tapping the mail icon, tapping the title of a message thread, scrolling to the bottom of the thread, hitting reply, typing something, and then refreshing the page.

If it helps at all, [this](https://gradientdescent.co/) is my Discourse.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 5, 2019, 1:27am UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/8 "2019-11-05T01:27:56Z")

</div>

> [@strangecosmos](#):
>
> If it helps at all, [this](https://gradientdescent.co/) is my Discourse.

It helps tons, your last commit is Friday October 11, that is prior to my draft fixes. You got to update to latest tests-passed and see if there is any way you can swing this error.

For the record I was able to reproduce all sorts of very quirky draft things prior to my last round of fixes.

---

<div class="post-metadata">

### Author: ![strangecosmos](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/strangecosmos/32/197291_2.png) [@strangecosmos](https://meta.discourse.org/u/strangecosmos)
#### Post date: [November 5, 2019, 11:18am UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/9 "2019-11-05T11:18:33Z")

</div>

My admin dashboard tells me I’m running the latest version. How do I update?

**Edit:** Found the answer here:

> [@How to stay updated of updates?](https://meta.discourse.org/t/how-to-stay-updated-of-updates/72897/2):
>
> by going to https://\<domain name\>/admin/upgrade – it will track the tests-passed branch by default, which in my experience has been relatively stable. From this URL, you can update all plugins as well.

---

<div class="post-metadata">

### Author: ![Justin\_Vega](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin_vega/32/159021_2.png) [@Justin\_Vega](https://meta.discourse.org/u/Justin_Vega)
#### Post date: [November 5, 2019, 2:20pm UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/10 "2019-11-05T14:20:34Z")

</div>

Which iPhone do you have and which version of iOS are you running on it? The latest version of iOS (13.2) has had RAM management issues.

That’d be my best guess. Either way, I wish you luck! 🤞

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 5, 2019, 7:56pm UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/11 "2019-11-05T19:56:32Z")

</div>

The draft inconsistencies had nothing to do with device or web instability. There were rare cases in which the system used to say “draft saved” and a draft was not saved, this is now fixed.

---

<div class="post-metadata">

### Author: ![Justin\_Vega](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin_vega/32/159021_2.png) [@Justin\_Vega](https://meta.discourse.org/u/Justin_Vega)
#### Post date: [November 5, 2019, 8:00pm UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/12 "2019-11-05T20:00:57Z")

</div>

It’s good to hear that the problem was fixed! Thank you for informing me. 👍

---

<div class="post-metadata">

### Author: ![strangecosmos](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/strangecosmos/32/197291_2.png) [@strangecosmos](https://meta.discourse.org/u/strangecosmos)
#### Post date: [November 5, 2019, 10:57pm UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/13 "2019-11-05T22:57:51Z")

</div>

Okay, glad to hear the issue I reported had already been solved. I just needed to upgrade to the latest version.

Thanks for all your help. Much appreciated.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [November 6, 2019, 1:20am UTC](https://meta.discourse.org/t/direct-message-draft-is-lost-when-page-is-refreshed/132515/14 "2019-11-06T01:20:20Z")

</div>


