prevent @room pills being applied multiple times when rerendering

This commit is contained in:
Bruno Windels 2019-06-14 18:26:01 +02:00
parent 78971f168f
commit 497ba1ecd4

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;