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

fix: await re-creating player before updating video #363

Merged

Conversation

ashphy
Copy link
Contributor

@ashphy ashphy commented Jun 18, 2022

When the videoId is changed, resetPlayer and updateVideo will be called in order.
However, because it doesn't wait for the resetPlayer (asynchronous method), loadVideoById in updateVideo will be called before the new player creates. It causes null access.

Is there any reason not to use async/await? If so, I'll rewrite it with Promise.

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit cfe657d:

Sandbox Source
react-youtube-example Configuration

@ruisaraiva19
Copy link
Collaborator

@ashphy no reason for not using async/await. Thanks for the pull request.

@ruisaraiva19 ruisaraiva19 merged commit 78effbb into tjallingt:canary Jun 19, 2022
@github-actions
Copy link
Contributor

🎉 This PR is included in version react-youtube-v9.0.2-canary.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link
Contributor

🎉 This PR is included in version react-youtube-v9.0.3-canary.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2022

🎉 This PR is included in version react-youtube-v9.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants