-
Notifications
You must be signed in to change notification settings - Fork 129
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
PSA: Vite bundler HMR re-render bug #287
Labels
Comments
Wow. Thank you very much, I think we need to add this to docs. Cleaning the DOM tree is good idea in any case. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PSA for those following the React bootstrap instructions on site documentation
Issue: Vite's hot module reloader doesn't clean up React DosPlayer component properly
Context:
New to js-dos, so I decided to follow the React bootstrap instructions https://js-dos.com/v7/build/docs/react/ in the doco but using Vite instead.
Ran into the issue where the dos player component was re-rendering itself on every save, but only re-rendering once on first load.
I'd get stuck with something like this
instance.stop()
for cleanup.Fix:
root.innerHTML = '';
to the DosPlayer return function to make sure it's cleaning up on every render properly.Typescript component ends up looking a little like this:
End of the day, it's not a js-dos issue but a weird interaction with Vite.
Just thought it might be helpful for people who run into the same issue. It gave me a headache far longer than it should have 🤣
Good day
The text was updated successfully, but these errors were encountered: