Overview
Replace $effect blocks that sync internalContent from content prop with $derived pattern.
Problem Statement
Four node components use the anti-pattern of syncing a prop to internal state via $effect:
let internalContent = $state(content);
$effect(() => {
internalContent = content;
});
This is unnecessary state duplication. The internalContent can simply be derived from content.
Files to Modify
- calendar.svelte (line 39) - sync external value to internal
- code-block-node.svelte (line 76) - sync internalContent
- ordered-list-node.svelte (line 54) - sync internalContent
- quote-block-node.svelte (line 55) - sync internalContent
Proposed Solution
Replace with $derived:
// BEFORE
let internalContent = $state(content);
$effect(() => {
internalContent = content;
});
// AFTER
const internalContent = $derived(content);
Or if mutation is needed, use bind:content in parent and remove internal state entirely.
Acceptance Criteria
Related Issues
Overview
Replace
$effectblocks that syncinternalContentfromcontentprop with$derivedpattern.Problem Statement
Four node components use the anti-pattern of syncing a prop to internal state via
$effect:This is unnecessary state duplication. The
internalContentcan simply be derived fromcontent.Files to Modify
Proposed Solution
Replace with
$derived:Or if mutation is needed, use
bind:contentin parent and remove internal state entirely.Acceptance Criteria
bun run test:all)bun run quality:fix)Related Issues