We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In Svelte 5, classes are no longer auto-reactive (see migration guide).
I'm trying to use CodeMirror, but I'm running into issues with how to manage the editor instance. For example, the following code seems problematic:
let editor = $state(); $effect.pre(() => { editor = new EditorView(...); return () => editor?.destroy(); });
The issue arises because the props of the EditorView class are not wrapped in $state(...), which means they're not reactive.
Is there a recommended way to handle this in Svelte 5? How can I ensure that the editor instance and its properties remain reactive in this scenario?
https://svelte.dev/playground/0aca148ac2fc4301b6b5a7605dc57c7d?version=5.2.8
No response
All
annoyance
The text was updated successfully, but these errors were encountered:
Duplicate of:
See in particular this comment.
Sorry, something went wrong.
No branches or pull requests
Describe the bug
In Svelte 5, classes are no longer auto-reactive (see migration guide).
I'm trying to use CodeMirror, but I'm running into issues with how to manage the editor instance. For example, the following code seems problematic:
The issue arises because the props of the EditorView class are not wrapped in $state(...), which means they're not reactive.
Is there a recommended way to handle this in Svelte 5? How can I ensure that the editor instance and its properties remain reactive in this scenario?
Reproduction
https://svelte.dev/playground/0aca148ac2fc4301b6b5a7605dc57c7d?version=5.2.8
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: