Make componentDidMount async
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
parent
98e602f544
commit
27b2b5b65d
|
@ -84,14 +84,12 @@ export default class DesktopCapturerSourcePicker extends React.Component<
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
async componentDidMount() {
|
||||||
// setInterval() first waits and then executes, therefore
|
// setInterval() first waits and then executes, therefore
|
||||||
// we call getDesktopCapturerSources() here without any delay.
|
// we call getDesktopCapturerSources() here without any delay.
|
||||||
// Otherwise the dialog would be left empty for some time.
|
// Otherwise the dialog would be left empty for some time.
|
||||||
getDesktopCapturerSources().then((result) => {
|
|
||||||
this.setState({
|
this.setState({
|
||||||
sources: result,
|
sources: await getDesktopCapturerSources(),
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// We update the sources every 500ms to get newer thumbnails
|
// We update the sources every 500ms to get newer thumbnails
|
||||||
|
|
Loading…
Reference in New Issue