diff --git a/src/editor/deserialize.js b/src/editor/deserialize.js index 200f3eb885..9307812bad 100644 --- a/src/editor/deserialize.js +++ b/src/editor/deserialize.js @@ -27,6 +27,9 @@ function parseAtRoomMentions(text, partCreator) { if (textPart.length) { parts.push(partCreator.plain(textPart)); } + // it's safe to never append @room after the last text + // as split will report an empty string at the end if + // `text` ended in @room. const isLast = i === arr.length - 1; if (!isLast) { parts.push(partCreator.atRoomPill(ATROOM));