Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 42d6999

Browse files
authored
Merge pull request #2650 from matrix-org/bwindels/fixcomminvites
Fix community invites crashing the app
2 parents 321dd49 + 05ddee6 commit 42d6999

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

res/css/views/rooms/_RoomTile.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,7 @@ limitations under the License.
191191
.mx_RoomTile.mx_RoomTile_transparent:focus {
192192
background-color: $roomtile-transparent-focused-color;
193193
}
194+
195+
.mx_GroupInviteTile .mx_RoomTile_name {
196+
flex: 1;
197+
}

src/components/structures/RoomSubList.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -282,18 +282,10 @@ const RoomSubList = React.createClass({
282282
this.setState({scrollTop: this.refs.scroller.getScrollTop()});
283283
},
284284

285-
_getRenderItems: function() {
286-
// try our best to not create a new array
287-
// because LazyRenderList rerender when the items prop
288-
// is not the same object as the previous value
289-
const {list, extraTiles} = this.props;
290-
if (!extraTiles || !extraTiles.length) {
291-
return list;
292-
}
293-
if (!list || list.length) {
294-
return extraTiles;
295-
}
296-
return list.concat(extraTiles);
285+
_canUseLazyListRendering() {
286+
// for now disable lazy rendering as they are already rendered tiles
287+
// not rooms like props.list we pass to LazyRenderList
288+
return !this.props.extraTiles || !this.props.extraTiles.length;
297289
},
298290

299291
render: function() {
@@ -310,7 +302,7 @@ const RoomSubList = React.createClass({
310302
return <div ref="subList" className={subListClasses}>
311303
{this._getHeaderJsx(isCollapsed)}
312304
</div>;
313-
} else {
305+
} else if (this._canUseLazyListRendering()) {
314306
return <div ref="subList" className={subListClasses}>
315307
{this._getHeaderJsx(isCollapsed)}
316308
<IndicatorScrollbar ref="scroller" className="mx_RoomSubList_scroll" onScroll={ this._onScroll }>
@@ -319,7 +311,16 @@ const RoomSubList = React.createClass({
319311
height={ this.state.scrollerHeight }
320312
renderItem={ this.makeRoomTile }
321313
itemHeight={34}
322-
items={this._getRenderItems()} />
314+
items={ this.props.list } />
315+
</IndicatorScrollbar>
316+
</div>;
317+
} else {
318+
const roomTiles = this.props.list.map(r => this.makeRoomTile(r));
319+
const tiles = roomTiles.concat(this.props.extraTiles);
320+
return <div ref="subList" className={subListClasses}>
321+
{this._getHeaderJsx(isCollapsed)}
322+
<IndicatorScrollbar ref="scroller" className="mx_RoomSubList_scroll" onScroll={ this._onScroll }>
323+
{ tiles }
323324
</IndicatorScrollbar>
324325
</div>;
325326
}

src/components/views/groups/GroupInviteTile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export default React.createClass({
150150
const classes = classNames('mx_RoomTile mx_RoomTile_highlight', {
151151
'mx_RoomTile_menuDisplayed': this.state.menuDisplayed,
152152
'mx_RoomTile_selected': this.state.selected,
153+
'mx_GroupInviteTile': true,
153154
});
154155

155156
return (

0 commit comments

Comments
 (0)