diff --git a/react/features/invite/components/info-dialog/PasswordForm.web.js b/react/features/invite/components/info-dialog/PasswordForm.web.js index e5115271d..e75faea57 100644 --- a/react/features/invite/components/info-dialog/PasswordForm.web.js +++ b/react/features/invite/components/info-dialog/PasswordForm.web.js @@ -55,6 +55,17 @@ type State = { * @extends Component */ class PasswordForm extends Component { + /** + * Implements React's {@link Component#getDerivedStateFromProps()}. + * + * @inheritdoc + */ + static getDerivedStateFromProps(props, state) { + return { + enteredPassword: props.editEnabled ? state.enteredPassword : '' + }; + } + state = { enteredPassword: '' }; @@ -74,19 +85,6 @@ class PasswordForm extends Component { this._onPasswordSubmit = this._onPasswordSubmit.bind(this); } - /** - * Implements React's {@link Component#componentWillReceiveProps()}. Invoked - * before this mounted component receives new props. - * - * @inheritdoc - * @param {Props} nextProps - New props component will receive. - */ - componentWillReceiveProps(nextProps: Props) { - if (this.props.editEnabled && !nextProps.editEnabled) { - this.setState({ enteredPassword: '' }); - } - } - /** * Implements React's {@link Component#render()}. * @@ -182,5 +180,4 @@ class PasswordForm extends Component { } } - export default translate(PasswordForm);