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

[Console Error] Cannot read properties of null #318

Open
ecenazelverdi opened this issue May 30, 2023 · 2 comments
Open

[Console Error] Cannot read properties of null #318

ecenazelverdi opened this issue May 30, 2023 · 2 comments
Labels

Comments

@ecenazelverdi
Copy link

ecenazelverdi commented May 30, 2023

image
There was a time when I needed to render the animation too much and keep calling the cleanup function but this caused a console error. I tried to use cleanupInstance but it sends another console just by rendering the element once.
image
There was nothing in the document that addressed this issue and this console error keeps popping. I tried to use eventCleanup not to cause a console error but this causes a memory leak for looped rive animations (noninteractive ones), causing the page to crash. I use Vue2, and these clean functions in the destroyed() hook. (I use version 1.1.8)

@zplata
Copy link
Contributor

zplata commented May 30, 2023

Hi @EE539 - do you have a reproducible sandbox you can provide with this scenario so it can be triaged further? Curious if cleanup() is being called twice on the same Rive instance.

@ecenazelverdi
Copy link
Author

Hello, I fixed my problem using these functions:
destroyed() { this.rive?.stopRendering(); this.rive?.cleanupInstances(); },
I'm using Vue2, the problem is that when I change something non-stop (because of the way the system was created), our page renders itself (not like F5 or CTRL+shift+R, it just re-renders every element it has). So if anything about an element changes (for example, color), it re-renders every element again. Doing this too much (like changing the color of the element nonstop) created this issue. But when I used stopRendering and cleanupInstances together instead of the cleanup() function, these console errors perished. I don't really know why though. cleanup() also has these functions so I didn't understand what was causing this error (Maybe deleting rive files before it's created but this error comes from the Draw function so I am not sure). I was also wondering if using stopRendering function causes any trouble with the way I used it! (The problem is basically when I create and remove it too fast, and if I am also using the cleanup function, these console errors show up)

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

No branches or pull requests

2 participants