Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 891e9b5

Browse files
authored
Merge pull request #6622 from SimonBrandner/release/fix/glare/18538
[Release] Fix glare related regressions
2 parents ed7dea9 + 8770317 commit 891e9b5

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/components/views/voip/CallView.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export default class CallView extends React.Component<IProps, IState> {
129129
constructor(props: IProps) {
130130
super(props);
131131

132-
const { primary, secondary } = this.getOrderedFeeds(this.props.call.getFeeds());
132+
const { primary, secondary } = CallView.getOrderedFeeds(this.props.call.getFeeds());
133133

134134
this.state = {
135135
isLocalOnHold: this.props.call.isLocalOnHold(),
@@ -166,7 +166,16 @@ export default class CallView extends React.Component<IProps, IState> {
166166
dis.unregister(this.dispatcherRef);
167167
}
168168

169-
public componentDidUpdate(prevProps) {
169+
static getDerivedStateFromProps(props: IProps): Partial<IState> {
170+
const { primary, secondary } = CallView.getOrderedFeeds(props.call.getFeeds());
171+
172+
return {
173+
primaryFeed: primary,
174+
secondaryFeeds: secondary,
175+
};
176+
}
177+
178+
public componentDidUpdate(prevProps: IProps): void {
170179
if (this.props.call === prevProps.call) return;
171180

172181
this.setState({
@@ -220,7 +229,7 @@ export default class CallView extends React.Component<IProps, IState> {
220229
};
221230

222231
private onFeedsChanged = (newFeeds: Array<CallFeed>) => {
223-
const { primary, secondary } = this.getOrderedFeeds(newFeeds);
232+
const { primary, secondary } = CallView.getOrderedFeeds(newFeeds);
224233
this.setState({
225234
primaryFeed: primary,
226235
secondaryFeeds: secondary,
@@ -253,7 +262,7 @@ export default class CallView extends React.Component<IProps, IState> {
253262
this.showControls();
254263
};
255264

256-
private getOrderedFeeds(feeds: Array<CallFeed>): { primary: CallFeed, secondary: Array<CallFeed> } {
265+
static getOrderedFeeds(feeds: Array<CallFeed>): { primary: CallFeed, secondary: Array<CallFeed> } {
257266
let primary;
258267

259268
// Try to use a screensharing as primary, a remote one if possible

0 commit comments

Comments
 (0)