Fix Svelte reactivity issues (updated)#34
Open
banjerluke wants to merge 5 commits into
Open
Conversation
Returning the $state variable directly meant consumers held a stale reference after reassignment. Wrap resolved values in getter-based proxy objects so each property access reads through the closure, keeping Svelte 5's fine-grained reactivity intact. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restore a panel's base values when the currently active preset is deleted so the UI's fallback to Version 1 matches the actual state.
Contributor
Author
|
Damn, just looking over the diff, looks like there's less formatting churn in some places, but more in others. I think I had auto-formatting on accidentally in my editor a couple times. I can try to fix that if you want, or perhaps I should just add Prettier or oxfmt and run it on the whole src/svelte directory? (Big fan of auto formatters...) |
Measure slider label and value widths reactively in Svelte so overlap detection stays current, while keeping the resulting handle dodge behavior aligned with the React implementation.
Store bind:this element references as values with null initialization across the Svelte components that keep DOM refs, matching the runtime shape and removing the remaining non-reactive ref warnings for those bindings. Capture initial Svelte prop values with untrack where they are intended to seed local state, and keep effects focused on subscriptions/DOM side effects. Also replace the remaining non-void self-closing tags so svelte-check only reports the existing accessibility warnings.
Contributor
Author
|
@joshpuckett I got those unrelated formatting changes out of the PR. We've been using this version in our Svelte dev workflow with no issues. (And we are grateful to have the tool!) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated version of #22 that is rebased on the latest
mainand also has a bit less formatting churn.Changes:
DialKitValuesfromcreateDialKitso property reads stay reactive after$statereassignment (major issue).currentsnapshot property fromDialKitValues(dead code removal)bind:thisrefs to$state<... | null>(null)so they match Svelte 5’s runtime shape and stop relying on non-reactive element locals