Skip to content

Create ReactiveNodeData store with debounced content updates #554

Closed

Description

@malibio

Overview

Create a reactive store for node data that separates content from structure. This store handles node properties with debounced content updates while providing immediate updates for critical properties.

Self-Contained Scope

  • Reactive Svelte 5 store for node data (content, properties, metadata)
  • LIVE SELECT subscription to node events
  • Debounced content updates (400ms for optimal typing batching)
  • Immediate property updates for critical data
  • Complete separation from structure (no beforeSiblingId or parentId)

Implementation Approach

  1. Store node data in reactive Map using $state
  2. Subscribe to node:created, node:updated, node:deleted events
  3. Implement debounced content updates
  4. Provide immediate updates for properties
  5. Test multi-client synchronization

Acceptance Criteria

  • Create src/lib/stores/reactive-node-data.svelte.ts
  • Implement $state Map: nodeId → Node (data only, no structure)
  • Subscribe to Tauri events: node:created, node:updated, node:deleted
  • Implement getNode(nodeId): Node (reactive getter)
  • Implement updateContent(nodeId, content) with 400ms debounce
  • Implement updateProperties(nodeId, properties) with immediate persistence
  • Initialize with bulk load from backend on startup
  • All content editing tests pass with new store
  • Performance: 50% fewer database writes (better batching from 400ms debounce)

Technical Implementation Notes

See architecture document for complete implementation with debounce logic and event handling.

Dependencies

Related Issues

Definition of Done

  • ReactiveNodeData store created and working
  • LIVE SELECT events update data automatically
  • Content updates debounced to 400ms
  • Property updates immediate
  • Multi-client sync working
  • All content tests passing

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions