Repository navigation
Consolidate Dual Node Store Architecture - Eliminate nodeData in Favor of sharedNodeStore - #682
Conversation
) ## Summary - Converted sharedNodeStore to Svelte 5 $state for automatic reactivity - Migrated TextNode, DateNode from nodeData to sharedNodeStore - Updated OptimisticOperationManager to use sharedNodeStore - Removed deprecated reactive-node-data.svelte.ts (and its tests) - Removed viewedNodeCache workaround (no longer needed with $state) - Updated all imports to use .svelte.ts extension ## Changes - `sharedNodeStore.nodes` now uses `$state(new Map<string, Node>())` - Added `snapshot()` and `restore()` methods for optimistic rollback - Components using `$derived(sharedNodeStore.getNode(nodeId))` now automatically re-render when nodes change (cross-pane reactivity) ## Test Results - Frontend: 74 test files, 1469 tests passed (24 tests removed with deleted file) - Backend: 516 passed, 0 failed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Code Review: PR #682 - Consolidate Dual Node Store ArchitectureReview TypeInitial Review (No prior reviews detected) SummaryThis PR successfully addresses Issue #679 by consolidating the dual node store architecture into a single
The change results in a net reduction of ~994 lines of code while improving cross-pane reactivity. Requirements Validation
FindingsCritical IssuesNone identified. The implementation correctly addresses the architectural problem of having two unsynchronized stores. The Svelte 5 Suggested Improvements1. [Improvement] Document test helper method visibility📁 packages/desktop-app/src/lib/services/shared-node-store.svelte.ts:2279 The /**
* Reset store state (for testing only)
* @internal
*/
__resetForTesting(): void {Rationale: Documentation consistency helps future maintainers understand API boundaries (DRY principle for documentation). 2. [Improvement] Consider extracting SimplePersistenceCoordinator📁 packages/desktop-app/src/lib/services/shared-node-store.svelte.ts:54-245 The Rationale: Single Responsibility Principle - the store file is already 2300+ lines. This extraction would improve maintainability without changing functionality. Status: This is non-blocking as the current implementation is correct and well-documented. NitpicksNit: Test import consistency📁 packages/desktop-app/src/tests/services/optimistic-operation-manager.test.ts:18 The import path uses the new Architecture AssessmentPositive Changes
Risk AssessmentLow Risk: This is a consolidation refactor that removes redundant code while preserving existing interfaces. The changes are straightforward import path updates and the addition of Test ResultsAll tests pass. The deleted RecommendationAPPROVE ✅ This PR successfully consolidates the dual store architecture into a single source of truth with proper Svelte 5 reactivity. The implementation:
The suggested improvements are optional and can be addressed in future iterations. 🤖 Generated with Claude Code |
Review Recommendations - AddressedSummary
Quality Checks
ConclusionNo code changes required. The 🤖 Generated with Claude Code |
) (#682) ## Summary - Converted sharedNodeStore to Svelte 5 $state for automatic reactivity - Migrated TextNode, DateNode from nodeData to sharedNodeStore - Updated OptimisticOperationManager to use sharedNodeStore - Removed deprecated reactive-node-data.svelte.ts (and its tests) - Removed viewedNodeCache workaround (no longer needed with $state) - Updated all imports to use .svelte.ts extension ## Changes - `sharedNodeStore.nodes` now uses `$state(new Map<string, Node>())` - Added `snapshot()` and `restore()` methods for optimistic rollback - Components using `$derived(sharedNodeStore.getNode(nodeId))` now automatically re-render when nodes change (cross-pane reactivity) ## Test Results - Frontend: 74 test files, 1469 tests passed (24 tests removed with deleted file) - Backend: 516 passed, 0 failed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
) (#682) ## Summary - Converted sharedNodeStore to Svelte 5 $state for automatic reactivity - Migrated TextNode, DateNode from nodeData to sharedNodeStore - Updated OptimisticOperationManager to use sharedNodeStore - Removed deprecated reactive-node-data.svelte.ts (and its tests) - Removed viewedNodeCache workaround (no longer needed with $state) - Updated all imports to use .svelte.ts extension ## Changes - `sharedNodeStore.nodes` now uses `$state(new Map<string, Node>())` - Added `snapshot()` and `restore()` methods for optimistic rollback - Components using `$derived(sharedNodeStore.getNode(nodeId))` now automatically re-render when nodes change (cross-pane reactivity) ## Test Results - Frontend: 74 test files, 1469 tests passed (24 tests removed with deleted file) - Backend: 516 passed, 0 failed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
) (#682) ## Summary - Converted sharedNodeStore to Svelte 5 $state for automatic reactivity - Migrated TextNode, DateNode from nodeData to sharedNodeStore - Updated OptimisticOperationManager to use sharedNodeStore - Removed deprecated reactive-node-data.svelte.ts (and its tests) - Removed viewedNodeCache workaround (no longer needed with $state) - Updated all imports to use .svelte.ts extension ## Changes - `sharedNodeStore.nodes` now uses `$state(new Map<string, Node>())` - Added `snapshot()` and `restore()` methods for optimistic rollback - Components using `$derived(sharedNodeStore.getNode(nodeId))` now automatically re-render when nodes change (cross-pane reactivity) ## Test Results - Frontend: 74 test files, 1469 tests passed (24 tests removed with deleted file) - Backend: 516 passed, 0 failed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
Closes #679