ref(recording-label): derive when the label state is no longer stale
This commit is contained in:
parent
f13cfe70f3
commit
d4e18e78fa
|
@ -54,6 +54,18 @@ const STALE_TIMEOUT = 10 * 1000;
|
||||||
*/
|
*/
|
||||||
export default class AbstractRecordingLabel
|
export default class AbstractRecordingLabel
|
||||||
extends Component<Props, State> {
|
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.
|
* Initializes a new {@code AbstractRecordingLabel} component.
|
||||||
*
|
*
|
||||||
|
@ -70,12 +82,12 @@ export default class AbstractRecordingLabel
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements {@code Component#componentWillReceiveProps}.
|
* Implements {@code Component#componentDidUpdate}.
|
||||||
*
|
*
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
componentWillReceiveProps(newProps: Props) {
|
componentDidUpdate(prevProps: Props) {
|
||||||
this._updateStaleStatus(this.props, newProps);
|
this._updateStaleStatus(prevProps, this.props);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,13 +149,8 @@ export default class AbstractRecordingLabel
|
||||||
}
|
}
|
||||||
}, STALE_TIMEOUT);
|
}, STALE_TIMEOUT);
|
||||||
}
|
}
|
||||||
} else if (this.state.staleLabel) {
|
|
||||||
this.setState({
|
|
||||||
staleLabel: false
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue