Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
ref(info): use getDerivedStateFromProps to update state
Leonard Kime9b2518f8adc
diff --git a/react/features/invite/components/info-dialog/InfoDialog.web.js b/react/features/invite/components/info-dialog/InfoDialog.web.jsindex 9ae652c46c..dbb7b1fcbb 100644--- a/react/features/invite/components/info-dialog/InfoDialog.web.js+++ b/react/features/invite/components/info-dialog/InfoDialog.web.js@@ -112,6 +112,28 @@ type State = {class InfoDialog extends Component<Props, State> {_copyElement: ?Object;+ /**+ * Implements React's {@link Component#getDerivedStateFromProps()}.+ *+ * @inheritdoc+ */+ static getDerivedStateFromProps(props, state) {+ let phoneNumber = state.phoneNumber;++ if (!state.phoneNumber && props.dialIn.numbers) {+ const { defaultCountry, numbers } = props.dialIn;++ phoneNumber = _getDefaultPhoneNumber(numbers, defaultCountry);+ }++ return {+ // Exit edit mode when a password is set locally or remotely.+ passwordEditEnabled: state.passwordEditEnabled && props._password+ ? false : state.passwordEditEnabled,+ phoneNumber+ };+ }+/*** {@code InfoDialog} component's local state.*@@ -162,28 +184,6 @@ class InfoDialog extends Component<Props, State> {this._setCopyElement = this._setCopyElement.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) {- if (!this.props._password && nextProps._password) {- this.setState({ passwordEditEnabled: false });- }-- if (!this.state.phoneNumber && nextProps.dialIn.numbers) {- const { defaultCountry, numbers } = nextProps.dialIn;-- this.setState({- phoneNumber:- _getDefaultPhoneNumber(numbers, defaultCountry)- });- }- }-/*** Implements React's {@link Component#render()}.*