Replace internalContent prop sync effects with $derived - #696
Conversation
Eliminate $effect blocks that sync internalContent from content prop in code-block-node, ordered-list-node, and quote-block-node components. The $effect was unnecessary because: 1. internalContent is initialized from content via $state(content) 2. User edits flow through handleContentChange which updates internalContent 3. Parent then receives contentChanged event and updates content prop 4. Component remount handles external content changes Note: calendar.svelte was NOT modified - its $effect is a necessary workaround for bits-ui's Svelte 5 binding limitations (two-way binding bridge pattern documented in component). Closes #693 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Code Review: PR #696 - Replace internalContent prop sync effects with $derivedSummaryThis PR removes redundant Review Decision: APPROVE (with clarification notes)FindingsClarification on Acceptance Criteria DeviationThe implementation deviates from the original issue requirements (#693), but for valid technical reasons: Issue #693 proposed: // Replace $effect with $derived
const internalContent = $derived(content);Actual implementation: // Remove the $effect entirely, keep $state initialization
let internalContent = $state(content);
// NO $effect and NO $derivedWhy this deviation is correct:
calendar.svelte Correctly ExcludedThe commit message correctly notes that Code Quality Assessment
Positive Aspects
Acceptance Criteria Reconciliation
RecommendationUpdate issue #693 to reflect that:
The implementation is technically sound and the deviation from the original proposal is well-justified. Reviewed by: Principal Engineer AI Reviewer |
malibio
left a comment
There was a problem hiding this comment.
Review Status: APPROVE
The implementation correctly removes redundant $effect blocks while preserving the necessary mutable state pattern. The deviation from the original $derived proposal is technically justified due to the mutation requirements in handleContentChange handlers. Good documentation in comments explaining the pattern.
All tests pass (1469/1469). Ready to merge.
Eliminate $effect blocks that sync internalContent from content prop in code-block-node, ordered-list-node, and quote-block-node components. The $effect was unnecessary because: 1. internalContent is initialized from content via $state(content) 2. User edits flow through handleContentChange which updates internalContent 3. Parent then receives contentChanged event and updates content prop 4. Component remount handles external content changes Note: calendar.svelte was NOT modified - its $effect is a necessary workaround for bits-ui's Svelte 5 binding limitations (two-way binding bridge pattern documented in component). Closes #693 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
Eliminate $effect blocks that sync internalContent from content prop in code-block-node, ordered-list-node, and quote-block-node components. The $effect was unnecessary because: 1. internalContent is initialized from content via $state(content) 2. User edits flow through handleContentChange which updates internalContent 3. Parent then receives contentChanged event and updates content prop 4. Component remount handles external content changes Note: calendar.svelte was NOT modified - its $effect is a necessary workaround for bits-ui's Svelte 5 binding limitations (two-way binding bridge pattern documented in component). Closes #693 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
Eliminate $effect blocks that sync internalContent from content prop in code-block-node, ordered-list-node, and quote-block-node components. The $effect was unnecessary because: 1. internalContent is initialized from content via $state(content) 2. User edits flow through handleContentChange which updates internalContent 3. Parent then receives contentChanged event and updates content prop 4. Component remount handles external content changes Note: calendar.svelte was NOT modified - its $effect is a necessary workaround for bits-ui's Svelte 5 binding limitations (two-way binding bridge pattern documented in component). Closes #693 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
Closes #693