strudel icon indicating copy to clipboard operation
strudel copied to clipboard

fix: codemirror does not vanish anymore on hot reload

Open felixroos opened this issue 1 year ago • 1 comments

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 https://github.com/tidalcycles/strudel/pull/892 ?

felixroos avatar Jan 12 '24 18:01 felixroos

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

daslyfe avatar Feb 22 '24 00:02 daslyfe