You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-10 09:22:25 +03:00
Make componentDidMount async
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -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: await getDesktopCapturerSources(),
|
||||||
sources: result,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// We update the sources every 500ms to get newer thumbnails
|
// We update the sources every 500ms to get newer thumbnails
|
||||||
|
|||||||
Reference in New Issue
Block a user