-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Warnings with React 18 #1439
Comments
It looks like some change in React 18 is messing up the Notice the target iframe changes from Looking back, the implementation of |
Looks like this issue also stops happening if you remove |
Sorry, from where i should remove |
You can find it inside index.js |
Looks like this is fixed in React 18.1 |
@cookpete I am using React 18.1 but still getting these infinite warnings. FYI I am also using Next.js 12.1.6 |
Yep you’re right, sorry. I was confused with a different issue. |
There seems to be an issue with double loading of Youtube api, which overrides the Only first |
As a temporary workaround, you can use the patch below to apply @manishsharma004's changes from #1450 to your locally-installed NPM package. (Note: This patch is not exactly the same as the PR itself, because it applies to the compiled files, not the source files!) How to apply the fix manually / one-time:
How to apply this fix with a
--- node_modules/react-player/lib/Player.js 2022-05-07 18:04:18.000000000 +0200
+++ node_modules/react-player/lib/Player.js 2022-05-07 18:04:01.000000000 +0200
@@ -82,7 +82,10 @@
_defineProperty(_assertThisInitialized(_this), "handlePlayerMount", function (player) {
_this.player = player;
- _this.player.load(_this.props.url);
+ if (!_this.loaded?.[_this.props.url]) {
+ _this.player.load(_this.props.url);
+ _this.loaded = { [_this.props.url]: true };
+ }
_this.progress();
});
@@ -288,7 +291,10 @@
this.isLoading = true;
this.startOnPlay = true;
this.onDurationCalled = false;
- this.player.load(url, this.isReady);
+ if (!this.loaded?.[url]) {
+ this.player.load(url, this.isReady)
+ this.loaded = { [url]: true }
+ }
}
if (!prevProps.playing && playing && !this.isPlaying) {
|
Thanks @lehnerpat for the detailed guide on patch, however I wouldn't recommend patching your production code with a changes from someone who isn't a developer on the project(me) until it gets reviewed by project developers. So, I would suggest patching only if there's no other way. |
Yup, absolutely valid point!
I just needed a workaround for the time being and built it so I thought I'd share :)
…
On 7. May 2022, at 19:48, manishsharma004 ***@***.***> wrote:
Thanks @lehnerpat for the detailed guide on patch, however I wouldn't recommend patching your production code with a changes from someone who isn't a developer on the project(me) until it gets reviewed by project developers. So, I would suggest patching only if there's no other way.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
This should now be fixed, as of |
Current Behavior
Getting infinite warnings could not call getDuration, getCurrentTime, getVideoLoadedFraction on React 18.
This is only happening when React 18 with createRoot is used.
The app works fine, the video works fine only these infinite warnings are the issue.
Expected Behavior
Shouldn't have any warnings or any function calls.
Steps to Reproduce
Environment
The text was updated successfully, but these errors were encountered: