Skip to content

Fix Svelte reactivity issues (updated)#34

Open
banjerluke wants to merge 5 commits into
joshpuckett:mainfrom
strummachine:svelte-fixes
Open

Fix Svelte reactivity issues (updated)#34
banjerluke wants to merge 5 commits into
joshpuckett:mainfrom
strummachine:svelte-fixes

Conversation

@banjerluke
Copy link
Copy Markdown
Contributor

Updated version of #22 that is rebased on the latest main and also has a bit less formatting churn.

Changes:

  • return getter-backed DialKitValues from createDialKit so property reads stay reactive after $state reassignment (major issue)
  • remove the old unused .current snapshot property from DialKitValues (dead code removal)
  • restore base values when deleting the currently active preset so falling back to "Version 1" matches the actual panel state
  • measure slider label/value widths reactively and adjust opacity accordingly
  • normalize the remaining Svelte bind:this refs to $state<... | null>(null) so they match Svelte 5’s runtime shape and stop relying on non-reactive element locals
  • Fixed some Svelte warnings that were harmless but annoying

banjerluke and others added 2 commits April 19, 2026 10:11
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.
@banjerluke
Copy link
Copy Markdown
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.
@banjerluke
Copy link
Copy Markdown
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!)

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.

1 participant