MELS: check scroll on load + use mels-1,-2,... key

To fix https://github.com/vector-im/riot-web/issues/2916, force the checking of scroll position by calling _onWidgetLoad (might need renaming...) when a MELS is expanded/contracted.

Also use an keying scheme for MELS that doesn't depend on the events contained, but rather a simple incrementing index based on the order of the MELS as it appears amongst all MELS.
This commit is contained in:
Luke Barnard 2017-02-20 10:59:11 +00:00
parent 7d07e7f958
commit 6fead66f89
2 changed files with 11 additions and 5 deletions

View file

@ -30,6 +30,8 @@ module.exports = React.createClass({
avatarsMaxLength: React.PropTypes.number,
// The minimum number of events needed to trigger summarisation
threshold: React.PropTypes.number,
// Called when the MELS expansion is toggled
onToggle: React.PropTypes.func,
},
getInitialState: function() {
@ -63,6 +65,7 @@ module.exports = React.createClass({
this.setState({
expanded: !this.state.expanded,
});
this.props.onToggle();
},
/**