# Composer Messages Exception

**URL:** https://meta.discourse.org/t/composer-messages-exception/74829
**Category:** Bug
**Created:** [November 26, 2017, 12:38pm UTC](https://meta.discourse.org/t/composer-messages-exception/74829 "2017-11-26T12:38:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [November 26, 2017, 12:38pm UTC](https://meta.discourse.org/t/composer-messages-exception/74829/1 "2017-11-26T12:38:25Z")

</div>

Steps to repro:

1. On a vanilla instance with a new user, start to compose your first message.

2. The `education.new_topic` composer message will appear. Dismiss it.

3. Write until the draft process is triggered and the draft saves.

4. Refresh the page. The composer will re-open with your draft.

5. An exception will be thrown. [`_findMessages`](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/components/composer-messages.js.es6#L157) attempts to add the welcome message to `queuedForTyping`, which is `null` at the time it is assigned.

The issue is with the sequence of reseting `queuedForTyping` and initialising the async `find` for composer messages, see the `console.log` in the screenshot.

 ![47 PM](https://global.discourse-cdn.com/meta/original/3X/4/1/41b4473093965518ecc7c9a456ad352075f67c76.png)

One simple fix is to move the `queuedForTyping` assignment inside the `then` block of the composer-messages lookup, however I think there’s still race conditions with that solution. Nevertheless, that’s all I have time for right now…

[https://github.com/discourse/discourse/pull/5366](https://github.com/discourse/discourse/pull/5366)

---

<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 26, 2017, 10:44pm UTC](https://meta.discourse.org/t/composer-messages-exception/74829/2 "2017-11-26T22:44:05Z")

</div>

PR seems to work fine, so I am merging it in.

---

<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 26, 2017, 10:44pm UTC](https://meta.discourse.org/t/composer-messages-exception/74829/3 "2017-11-26T22:44:08Z")

</div>


