Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preload.mediadevices-shim: Promise returned in function argument where a void return was expected. #360

Closed
manusa opened this issue Oct 21, 2023 · 3 comments · Fixed by #361
Assignees
Labels
good first issue Good for newcomers hacktoberfest Hacktoberfest help wanted Extra attention is needed
Milestone

Comments

@manusa
Copy link
Owner

manusa commented Oct 21, 2023

Description

The following code has been marked as a bug:

const updateSourcesFunction = async () => setSources(await desktopCapturer.getSources(DEFAULT_SOURCES_OPTIONS));
useEffect(() => {
setTimeout(updateSourcesFunction, sources ? 300 : 0);
}, [sources]);

It should be changed to:

  const updateSourcesFunction = () => {
    desktopCapturer.getSources(DEFAULT_SOURCES_OPTIONS).then(setSources);
  };
  useEffect(() => {
    setTimeout(updateSourcesFunction, sources ? 300 : 0);
  }, [sources]);

Please note that for the tests to pass correctly, the following lines:

const desktopCapturer = {
// eslint-disable-next-line no-undef
getSources: opts => ipcRenderer.invoke(APP_EVENTS.desktopCapturerGetSources, opts)
};

need to be changed to:

const desktopCapturer = {
  // eslint-disable-next-line no-undef
  getSources: async opts => ipcRenderer.invoke(APP_EVENTS.desktopCapturerGetSources, opts)
};
@manusa manusa added help wanted Extra attention is needed good first issue Good for newcomers hacktoberfest Hacktoberfest labels Oct 21, 2023
@vishnukaushik
Copy link
Contributor

@manusa Could you please assign this task to me? I can work on it
Thanks!

@manusa
Copy link
Owner Author

manusa commented Oct 21, 2023

sure, thx!

@vishnukaushik
Copy link
Contributor

@manusa, I've raised a PR to solve this issue. Could you please take a look when you get a chance?
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest Hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants