https://spectrum.chat/?t=f58380fe-be5d-4b87-91ee-e2f2423014d4 crashes entire app

https://spectrum.chat/?t=5bb0b1a0-c897-4262-a397-707d61fdac34 crashes the chat input

FWIW, for https://spectrum.chat/thread/f58380fe-be5d-4b87-91ee-e2f2423014d4 the empty body seems to be the root cause.

I know the cause of the first one:
If a user composes a thread on Android, the thread type is set to TEXT. In the mutation, we check for these text types and convert them to draft state. However, the logic is this:
if (type === 'TEXT') {
type = 'DRAFTJS';
if (thread.content.body) {
thread.content.body = JSON.stringify(
markdownToDraft(thread.content.body)
);
}
}
As you can see, a thread composed on android without a body will not have any draft state set as the content.body, which crashes everything on the frontend.
A thread without a body should be converted to draftjs state like so:
"content": {
"body": "{"blocks":[{"key":"foo","text":"","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}" ,
"title": "Test"
} ,
cc @mxstbr :)
Let's add a resolver for the body field that returns "{}" if the body in the db is "" and the type is draft, that should fix it immediately for everybody?
I will try
I will try locally now.
Kk #3128 fixes the first thread crash listed in this issue. The chat input crashing on the second thread is still a mystery
@brianlovin @mxstbr I managed to replicate the chat issue locally. Create a thread and only add a block of code in the body.
@alejandronanez hm I can't repro with that step - I'm still able to type in the chat input
Try this:

:)
Ah, it needed a refresh. Good call - this is super weird cc @mxstbr
Here's the warning:

And deprecation link: https://www.chromestatus.com/features/6680566019653632
Digging in to see if other people are experiencing this....although it's bizarre that the thread content would impact the chat input in this way.
Another interesting side effect of this:
if you create a thread where the body is only a code block, then you go to edit the thread, it's not possible to escape the code block.
This was fixed in https://github.com/withspectrum/draft-js-markdown-plugin/pull/84!