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

render infinitely - scene, engine hooks #212

Closed
slash9494 opened this issue Mar 17, 2022 · 3 comments
Closed

render infinitely - scene, engine hooks #212

slash9494 opened this issue Mar 17, 2022 · 3 comments

Comments

@slash9494
Copy link

i found infinite render loop when i used hooks ( useScene, useEngine) in components (such as light, model)

but i have not been aware of it if i don't use dev tools like console and it seems to be alright

is it normal situation ?

@slash9494 slash9494 changed the title render infinitely scene, engine hooks render infinitely - scene, engine hooks Mar 17, 2022
@brianzinn
Copy link
Owner

can you share a repro - perhaps on codepen? I have never seen that before. sounds like you are saying that when you use devtools that it stops.... the render loop is running on the Engine automatically. Otherwise if you can share code here.

@slash9494
Copy link
Author

i find that my fps update state have made it render infinitely 😅
i think this code setFps(engine?.getFps() || 0 ) could generate useEngine

@brianzinn
Copy link
Owner

thanks for sharing the solution. setFps looks like a useState - that will cause a React render - not good performance to call every frame - poor performance. Better to do that outside of React - on the canvas or vanilla js. Glad you solved it 😄

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

No branches or pull requests

2 participants