You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace internalContent prop sync effects with $derived #693
The actual implementation differs from the original proposal, for valid technical reasons:
Original Proposal:
constinternalContent=$derived(content);
Actual Implementation:
letinternalContent=$state(content);// $effect removed entirely, not replaced with $derived
Why this approach is correct:
Mutable state required: These components modify internalContent within handleContentChange handlers (injecting language codes, adding prefixes). Using $derived(content) would make it read-only, breaking the mutation logic.
The $effect was truly redundant: The sync $effect(() => { internalContent = content; }) served no purpose because:
Initial sync: Already handled by $state(content) initialization
User edits: Flow through event handlers, not prop changes
External changes: Handled by component remount
calendar.svelte excluded: Its $effect is a necessary workaround for bits-ui's Svelte 5 binding limitations (two-way binding bridge pattern) - a fundamentally different use case.
Final count: 3 $effect blocks removed (not 4) since calendar.svelte was correctly preserved.
Activity
malibio commentedon Nov 30, 2025
Test baseline: Frontend 1469 passed (74 files), Rust 531 passed (16 ignored)
Remove redundant internalContent prop sync effects
malibio commentedon Nov 30, 2025
Implementation Notes (from PR #696 review)
The actual implementation differs from the original proposal, for valid technical reasons:
Original Proposal:
Actual Implementation:
Why this approach is correct:
Mutable state required: These components modify
internalContentwithinhandleContentChangehandlers (injecting language codes, adding prefixes). Using$derived(content)would make it read-only, breaking the mutation logic.The $effect was truly redundant: The sync
$effect(() => { internalContent = content; })served no purpose because:$state(content)initializationcalendar.svelte excluded: Its
$effectis a necessary workaround for bits-ui's Svelte 5 binding limitations (two-way binding bridge pattern) - a fundamentally different use case.Final count: 3 $effect blocks removed (not 4) since calendar.svelte was correctly preserved.
Remove redundant internalContent prop sync effects (#696)
Remove redundant internalContent prop sync effects (#696)
Remove redundant internalContent prop sync effects (#696)
Remove redundant internalContent prop sync effects (#696)