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

Fix bug in loadStyle and add destroy method for cleanup #353

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

LukasKalbertodt
Copy link
Contributor

Hi there!

In Tobira we noticed that unloading a Paella instance and loading a new one caused some console errors and other weird behavior. This PR tries to address some of that. The first commit adds a destroy method which does a complete cleanup. This is very useful for SPAs like Tobira, where Paella instances are created and destroyed again, and that shouldn't leave any traces. Without this destroy method, certain event handlers and other global values still exist. The destroy method fixes that.

The second commit is a simple bug fix where a promise sometimes returned undefined (by calling resolve() without arguments). That undefined value is later passed to a function that throws an error. You can see that on tobira.opencast.org when clicking on one video and then on a second one.

I hope these changes are ok like this!

This is intended to undo all side effects caused by the constructor.
Required for SPAs.
The promise accidentally returned nothing, meaning that `undefined` was
pushed to `__skinStyleSheets__`. Later, that undefined was passed to
`head.removeChild`, throwing an error.
@ferserc1 ferserc1 merged commit 64f34cb into polimediaupv:main Feb 15, 2024
2 checks passed
@LukasKalbertodt LukasKalbertodt deleted the fix-some-bugs branch February 15, 2024 10:40
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

Successfully merging this pull request may close these issues.

2 participants