Skip to content

Optimize textarea-controller content/config sync effects #695

Closed

Description

@malibio

Overview

Review and potentially eliminate the content sync and config sync $effect blocks in textarea-controller.svelte.ts by leveraging reactive getters.

Problem Statement

The TextareaController has effects for syncing content and config:

// textarea-controller.svelte.ts lines 982, 991
$effect(() => {
  // content sync effect
});

$effect(() => {
  // config sync effect
});

The factory pattern already provides reactive getters (() => content, () => editableConfig), so these sync effects may be unnecessary if controller methods read from getters directly.

Investigation Required

  1. Determine if controller methods can read from getters instead of cached values
  2. Verify that eliminating effects doesn't break reactivity
  3. Test thoroughly - this is a critical component

Proposed Solution

Replace effect-based synchronization with direct reactive reads:

// BEFORE: Cache value via effect
let cachedContent: string;
$effect(() => {
  cachedContent = getContent();
});

// AFTER: Read directly from getter in methods
function someMethod() {
  const content = getContent(); // Reactive read
  // ... use content
}

Files to Modify

  • textarea-controller.svelte.ts: Remove content/config sync effects, update methods to use getters

Acceptance Criteria

  • Content sync effect eliminated or justified as necessary
  • Config sync effect eliminated or justified as necessary
  • Edit mode works correctly (typing, cursor position)
  • Content changes persist correctly
  • All node types work with controller
  • Tests pass (bun run test:all)
  • Quality checks pass (bun run quality:fix)

Technical Notes

This is a higher-risk refactor than the prop-sync issues. The TextareaController is central to the editing experience and requires careful testing.

Related Issues

Activity

  1. self-assigned this
    on Nov 30, 2025
  2. malibio commented on Nov 30, 2025

    @malibio
    CollaboratorAuthor

    Test baseline: Frontend 728 passed, Rust 547 passed (3 skipped: vector search)

  3. malibio commented on Dec 1, 2025

    @malibio
    CollaboratorAuthor

    Completed in PR #699. Config sync effect eliminated via getter pattern; content sync effect retained with documented justification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions