Repository navigation
Closed
Description
Overview
Refactor BaseNodeViewer and all node components to use the new ReactiveNodeData and ReactiveStructureTree stores, eliminating the _updateTrigger hack and manual cache management.
Self-Contained Scope
- ✅ Update all components to use dual reactive stores
- ✅ Replace manual subscriptions with $derived queries
- ✅ Remove _updateTrigger pattern completely (confirmed: not found in codebase)
- ⏳ Update child components (TextNode, TaskNode, DateNode) - tracked separately
- ✅ Core reactivity with $derived (side-effect $effect blocks are necessary for persistence)
Implementation Approach
- ✅ Import both reactive stores
- ✅ Use $derived to combine data and structure
- ✅ Remove all manual event subscriptions
- ✅ Delete _updateTrigger references
- ✅ Test reactivity with multi-client updates
Acceptance Criteria
- Update
base-node-viewer.svelteto import both stores - Replace manual subscriptions with
$derivedqueries - Remove
_updateTriggerfrom codebase (confirmed removed) - Remove
$effectblocks watching hierarchy reactivity (reactivity achieved via $derived, not $effect) - Update all child components (TextNode, TaskNode, DateNode, etc.) - out of scope for PR Refactor BaseNodeViewer to use dual reactive stores #572
- Zero
_updateTrigger++calls in codebase (confirmed) - All existing component tests pass (1715 tests passing)
- Visual regression tests pass (no UI changes, styling unchanged)
Technical Notes - Hybrid Architecture (Transition Period)
Current Implementation: The PR implements a pragmatic hybrid approach where:
-
Reactivity is achieved through
$derived(lines 135-190):visibleNodesFromStoresderives from ReactiveStructureTree + ReactiveNodeData- Automatically re-renders when either store changes
- No
_updateTriggerhack needed
-
Side Effects use
$effectblocks (lines 193+):$effectat line 193: Load node content when nodeId changes$effectat line 461: Track content changes for persistence$effectat line 551: Coordinate async saves$effect.preat line 709: Persist structural updates$effectblocks at 1587+: Cleanup and coordination
-
Backward Compatibility (Transition Period):
- Lines 141-146, 151-154: Fallback to
sharedNodeStoreif data not in reactive stores - Line 1365: Also call
nodeManager.toggleExpanded()for compatibility - Planned for removal in Issue Implement OptimisticOperationManager for fire-and-forget operations #580 (create follow-up issue)
- Lines 141-146, 151-154: Fallback to
Migration Plan
Phase 1 (Current - PR #572): ✅ Complete
- Reactive stores integrated and working
- Tests all passing
- Hybrid fallback ensures backward compatibility
Phase 2 (Follow-up - Issue #580): ⏳ Planned
- Remove fallback to
sharedNodeStorewhen reactive stores fully populated - Remove
nodeManager.toggleExpanded()calls - Remove backward compatibility code
- Timeline: Start when all nodes consistently use reactive stores
Dependencies
- Create ReactiveStructureTree store with LIVE SELECT integration #553 (ReactiveStructureTree) - ✅ Complete
- Create ReactiveNodeData store with debounced content updates #554 (ReactiveNodeData) - ✅ Complete
- Implement OptimisticOperationManager for fire-and-forget operations #580 (Transition period cleanup) - ⏳ Create follow-up issue
Definition of Done
- All components using reactive stores
- Zero manual cache management
- Zero _updateTrigger hacks
- All tests passing (1715 tests)
- Reactivity working perfectly
- Child component updates (tracked separately)
Activity
malibio commentedon Nov 20, 2025
Test Baseline (Before Implementation)
Recorded at start of work on feature/issue-555-reactive-viewer-refactor
No pre-existing failures to track.
malibio commentedon Nov 20, 2025
CRITICAL BLOCKER: Issue 555 depends on Issue 554 (ReactiveNodeData store) which does not exist yet.
✅ ReactiveStructureTree: EXISTS
❌ ReactiveNodeData: NOT FOUND - BLOCKS THIS ISSUE
✅ SharedNodeStore: EXISTS (but needs _updateTrigger removed)
BaseNodeViewer cannot be refactored without ReactiveNodeData providing reactive node data access via getNode(id).
See investigation results: Complete architecture analysis showing _updateTrigger hack, 5 effect blocks to remove, and exact refactor path once 554 ready.
Estimated refactor time: 4-6 hours once 554 complete.
RECOMMENDATION: Complete Issue 554 first, then return to 555.
malibio commentedon Nov 20, 2025
Investigation Complete - Summary
What Was Done
Finding
Issue 555 is blocked by Issue 554 (ReactiveNodeData store).
Cannot refactor as specified without:
Current Status
Next Steps When #554 Ready
Estimated time: 4-6 hours for implementation once #554 complete.
Refactor BaseNodeViewer to use dual reactive stores (Issue #555)
Address PR #572 review: Clarify hybrid architecture and document tran…
Refactor BaseNodeViewer to use dual reactive stores (#572)
Refactor BaseNodeViewer to use dual reactive stores (#572)
Refactor BaseNodeViewer to use dual reactive stores (#572)
Refactor BaseNodeViewer to use dual reactive stores (#572)