Add keys to MessageBox

This commit is contained in:
khlieng 2015-02-19 01:13:23 +01:00
parent 2aeb8c97a3
commit 305ee753e3
2 changed files with 4 additions and 4 deletions

View File

@ -71,15 +71,15 @@ var MessageBox = React.createClass({
for (var j = 0; j < this.state.messages.length; j++) {
var message = this.state.messages[j];
var messageClass = 'message';
var key = message.server + dest + j;
if (message.type) {
messageClass += ' message-' + message.type;
}
lines.push(
<p className={messageClass}>
<p key={key} className={messageClass}>
<span className="message-time">{util.timestamp(message.time)}</span>
{message.from ? <span className="message-sender"> {message.from}</span> : null}
<span dangerouslySetInnerHTML={{ __html: ' ' + Autolinker.link(message.lines[0]) }}></span>
@ -88,7 +88,7 @@ var MessageBox = React.createClass({
for (var i = 1; i < message.lines.length; i++) {
lines.push(
<p className={messageClass}>
<p key={key + '-' + i} className={messageClass}>
<span dangerouslySetInnerHTML={{ __html: Autolinker.link(message.lines[i]) }}></span>
</p>
);

View File

@ -29,7 +29,7 @@ var messageLineStore = Reflux.createStore({
setWrapWidth: function(w) {
width = w;
wrap();
util.wrapMessages(messages, width, charWidth);
this.trigger(messages);
},