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

React: Nested Player instances causes hanging suspense - infinite redraw loop #494

Open
KieranTH opened this issue Aug 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@KieranTH
Copy link

KieranTH commented Aug 20, 2024

Describe the bug

This may be abusive usage of Player - if so, please let me know

This "problem" only crept up from version 0.8.0 - Looking at the deeper logs from the rendering infinite loop, seems to be coming from react-subscribe. Which is caused from the usage of reactPlayer.start(...).

Use-case
Currently I have instances of nested Player React components. The main use-case for this is due to a quirk of the ReactAsset component - Where if I have a plugin component which has Player schema JSON built into it, any attempts to access data via the {{}} special characters won't work. Which makes sense as the parsing is done pre-render, and as the rendering of the component with the nested schema JSON happens after the {{}} parsing. It wouldn't get picked up.

Imagine I have an initial page which is a Player component, which houses a Modal which contains a form. If the Modal/Form was its own React component with more schema JSON inside of it referencing more assets, that JSON would be outside of the scope of the initial page/view JSON.

Maybe if this kind of behaviour should be avoided... if so we may want to issue warnings or preventions about this type of view structure. We'd also need an alternative to post-parsing {{}} instances within a JSON through the ReactAsset component.

To Reproduce
This code sandbox illustrates the infinite suspense issue - But does not show the infinite rerender issue. I have a feeling that the complex level of my own implementation in my codebase may be the cause for that rendering loop, but quite difficult to port to a CodeSandbox.

Codesandbox

Expected behavior

A nested Player instance inside another Player instance should behave uniquely to the parent - This was the given behaviour up until 0.8.0. If this isn't feasible anymore, we should look to document the limitation and/or prevent it via warnings and throwing errors if a nested player issue is discovered.

Screenshots

Screenshot from 2024-08-20 12-59-53

@KieranTH KieranTH added the bug Something isn't working label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant