Make React Infinite stop throwing when theres only one child

This commit is contained in:
khlieng 2015-02-16 00:02:21 +01:00
parent ae78ac5017
commit fb77c29fd9
2 changed files with 17 additions and 8 deletions

View File

@ -88,6 +88,7 @@ var MessageBox = React.createClass({
return <p className="message">{line}</p>;
});
if (lines.length !== 1) {
return (
<div className="messagebox" style={style}>
<Infinite ref="list" containerHeight={this.state.height} elementHeight={24}>
@ -95,6 +96,13 @@ var MessageBox = React.createClass({
</Infinite>
</div>
);
} else {
return (
<div className="messagebox" style={style}>
<div ref="list">{lines}</div>
</div>
);
}
}
});

View File

@ -54,7 +54,8 @@ var selectedTabStore = Reflux.createStore({
userAdded: function(user, server, channel) {
// Update the selected channel incase the casing is different
if (server === selectedTab.server &&
if (selectedTab.channel &&
server === selectedTab.server &&
user === serverStore.getNick(server) &&
channel.toLowerCase() === selectedTab.channel.toLowerCase()) {
selectedTab.channel = channel;