Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Editing a message that contains just a space throws an error #10358
changed the title
editing a message that contains just a space throws an error
Jul 17, 2019
I looked into this issue and found the problem is when you send a message consisting of spaces with Markdown enabled, it creates a message consisting of an empty string. The error can be traced back to the
I would think the best course of action would be to not create the message at all, like what happens if the user tries to submit an empty string. In the
It would probably be good to also have more robust error handling in caret.js when it tries to access elements in an array that is empty. I've just begun looking at this code base so any feedback would be great.
Thank you for your investigation @zacharystenger ! As any client, and not just Riot, could create empty messages, it would probably be good to make the editor more robust. We should probably handle an empty parts array when setting the caret.
Also note that at the moment, we have two different implementations of our message composer. The main one, to send messages, and the one to edit them after they have been sent.
The latter one is quite recent, and I'm about the start replacing the old main composer with the new one, also using it for sending, so a lot of things will be changing in