Skip to content

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

Merged
ruisaraiva19 merged 1 commit intotjallingt:canaryfrom
ashphy:fix-call-reset-and-update-player-togther
Jun 19, 2022
Merged

fix: await re-creating player before updating video#363
ruisaraiva19 merged 1 commit intotjallingt:canaryfrom
ashphy:fix-call-reset-and-update-player-togther

Conversation

@ashphy
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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