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

Component destroyed #25

Closed
Alynva opened this issue Jul 26, 2018 · 7 comments
Closed

Component destroyed #25

Alynva opened this issue Jul 26, 2018 · 7 comments

Comments

@Alynva
Copy link

Alynva commented Jul 26, 2018

Please, do something with componentWillUnmount to stop the sketch. Without this, the sketch still working and invoking prop functions even though it was destroyed.

@Alynva
Copy link
Author

Alynva commented Jul 26, 2018

I tried make an isDead() in my component, pass it to the sketch and check if it's false in the p.draw() with an p.noLoop() in the else. But when my component will be unmounted, the render() it's no longer called, in other words, the <P5Wrapper /> will not receive new props.

Any help until wrapper update?

@abidabdelaziz
Copy link

When you have a similar issue and the solution is in another language :D.

@Alynva
Copy link
Author

Alynva commented Jul 26, 2018

what did you mean?

@abidabdelaziz
Copy link

It seems like when the issue was closed another discussion was referenced as part of the issue's closing, I dont understand the referenced discussion because its in another language. Thats all : )

As I am trying to tackle this issue I found this repo by @JobLeonard 'https://github.com/JobLeonard/p5-react' in which he addresses the mounting problems.

Im a newbie to both React and P5js so learning both of them at the same time and integrating them is quite the challenge :D.

@Alynva
Copy link
Author

Alynva commented Jul 26, 2018

AcademiaWired/Traxometro is where I'm working, and I created that issue there because the problem with the <P5Wrapper /> causes effects that block me to continue developing some things. That issue is not the solution to this issue, I referenced this issue here over there, and not that issue here. Do you understand?

I closed that issue because in my case, I know when my component will be destroyed and in this place I put p.noLoop() to stop the p.draw(). But it's doesn't solve the <P5Wrapper />'s unmount problem.

I will look into the other repo that you mentioned as soon as possible. Thanks for you help! :D

@Alynva
Copy link
Author

Alynva commented Jul 27, 2018

About the @JobLeonard's repo: It seems very good, and solve the unmount problem. But also create the canvas by it's self, and in my case I want draw directly using the context provided from canvas's element. To this propose, I'm using P5js library just to I don't have to worry about frame rate and the draw() loop to update my own canvas.

I think that it can be better, but I didn't find another soluction until now (P5js doesn't provide the context and doesn't draw like I want)

@and-who
Copy link
Contributor

and-who commented May 28, 2019

I just released a new Version since Ages 😅
Please check if your Issue got fixed.
If not please reopen this Issue or create a new one.

@and-who and-who closed this as completed May 28, 2019
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

3 participants