Generate previews for rooms when the option changes
Fixes https://github.com/vector-im/element-web/issues/14853 This likely regressed in https://github.com/matrix-org/matrix-react-sdk/pull/5048 when the message preview information was made state, and the component wasn't updating the preview when the control flags changed.
This commit is contained in:
parent
be2d0c9de7
commit
d866b2d9ef
1 changed files with 6 additions and 0 deletions
|
@ -120,6 +120,12 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
|
||||||
return !this.props.isMinimized && this.props.showMessagePreview;
|
return !this.props.isMinimized && this.props.showMessagePreview;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public componentDidUpdate(prevProps: Readonly<IProps>, prevState: Readonly<IState>) {
|
||||||
|
if (prevProps.showMessagePreview !== this.props.showMessagePreview && this.showMessagePreview) {
|
||||||
|
this.setState({messagePreview: this.generatePreview()});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
// when we're first rendered (or our sublist is expanded) make sure we are visible if we're active
|
// when we're first rendered (or our sublist is expanded) make sure we are visible if we're active
|
||||||
if (this.state.selected) {
|
if (this.state.selected) {
|
||||||
|
|
Loading…
Reference in a new issue