You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-19 05:22:13 +03:00
Ensure toggle switches listen to property changes
They do local echo on changes to avoid jumping back and forth while requests are ongoing, however some areas modify the checked state after the toggle has mounted. Fixes https://github.com/vector-im/riot-web/issues/8432
This commit is contained in:
@@ -38,6 +38,12 @@ export default class ToggleSwitch extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.checked !== this.state.checked) {
|
||||
this.setState({checked: nextProps.checked});
|
||||
}
|
||||
}
|
||||
|
||||
_onClick = (e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user