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(recording-label): derive when the label state is no longer stale

Leonard Kimd4e18e78faa1
diff --git a/react/features/recording/components/AbstractRecordingLabel.js b/react/features/recording/components/AbstractRecordingLabel.js
index 78fcb5c342..227e58cf73 100644
--- a/react/features/recording/components/AbstractRecordingLabel.js
+++ b/react/features/recording/components/AbstractRecordingLabel.js
@@ -54,6 +54,18 @@ const STALE_TIMEOUT = 10 * 1000;
*/
export default class AbstractRecordingLabel
extends Component<Props, State> {
+ /**
+ * Implements {@code Component#getDerivedStateFromProps}.
+ *
+ * @inheritdoc
+ */
+ static getDerivedStateFromProps(props: Props, prevState: State) {
+ return {
+ staleLabel: props._status !== JitsiRecordingConstants.status.OFF
+ && prevState.staleLabel ? false : prevState.staleLabel
+ };
+ }
+
/**
* Initializes a new {@code AbstractRecordingLabel} component.
*
@@ -70,12 +82,12 @@ export default class AbstractRecordingLabel
}
/**
- * Implements {@code Component#componentWillReceiveProps}.
+ * Implements {@code Component#componentDidUpdate}.
*
* @inheritdoc
*/
- componentWillReceiveProps(newProps: Props) {
- this._updateStaleStatus(this.props, newProps);
+ componentDidUpdate(prevProps: Props) {
+ this._updateStaleStatus(prevProps, this.props);
}
/**
@@ -137,13 +149,8 @@ export default class AbstractRecordingLabel
}
}, STALE_TIMEOUT);
}
- } else if (this.state.staleLabel) {
- this.setState({
- staleLabel: false
- });
}
}
-
}
/**