Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ref(info): derive when to clear the entered password state

Leonard Kime0cbb838be17
diff --git a/react/features/invite/components/info-dialog/PasswordForm.web.js b/react/features/invite/components/info-dialog/PasswordForm.web.js
index e5115271d9..e75faea57e 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<Props, State> {
+ /**
+ * 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<Props, State> {
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<Props, State> {
}
}
-
export default translate(PasswordForm);