prevent @room pills being applied multiple times when rerendering

pull/21833/head
Bruno Windels 2019-06-14 18:26:01 +02:00
parent 78971f168f
commit 497ba1ecd4
1 changed files with 7 additions and 1 deletions

View File

@ -214,7 +214,13 @@ module.exports = React.createClass({
// update the current node with one that's now taken its place // update the current node with one that's now taken its place
node = pillContainer; node = pillContainer;
} }
} else if (node.nodeType === Node.TEXT_NODE) { } else if (
node.nodeType === Node.TEXT_NODE &&
// as applying pills happens outside of react, make sure we're not doubly
// applying @room pills here, as a rerender with the same content won't touch the DOM
// to clear the pills from the last run of pillifyLinks
!node.parentElement.classList.contains("mx_AtRoomPill")
) {
const Pill = sdk.getComponent('elements.Pill'); const Pill = sdk.getComponent('elements.Pill');
let currentTextNode = node; let currentTextNode = node;