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: codemirror does not vanish anymore on hot reload #903

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

felixroos
Copy link
Collaborator

when saving certain files, for example superdough.mjs, the codemirror editor would just vanish.
It seems the hot reloading clears the #code element (Repl.jsx) without deleting the refs, so init won't be called again.
Luckily, there is an API for vite to hook into hot reloading life cycle: https://vitejs.dev/guide/api-hmr#hot-dispose-cb

I managed to at least clear the refs and stop the previous repl, so it will be recreated when the #code ref fires again.
I am not sure if it's even possible to hot swap the editor without loosing the context. maybe it is but maybe it's not worth the hassle. @daslyfe any idea? how is this related to #892 ?

@daslyfe
Copy link
Collaborator

daslyfe commented Feb 22, 2024

Sorry, forgot to respond to this one. iirc 892 was hot reloading failing to run on the newest pnpm version, not just the editor.

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