v5.2.1 (2025-11-07)
Breaking Changes: None (patch version)
Bug Fixes
This patch release fixes critical race conditions and state synchronization issues in the viewer UI's project filtering system.
Fixed Issues:
- Race condition with offset reset: When filter changed, offset wasn't reset synchronously, causing incorrect pagination ranges (e.g., loading items 20-40 for new project with < 20 items)
- State ref synchronization:
stateRef.current.hasMoreretained old value when filter changed, preventing new filter from loading if previous filter had no more data - Data mixing between projects: Batched state updates caused data from different projects to appear together in the UI
- useEffect dependency cycle:
handleLoadMorein dependencies caused double renders when filter changed - NULL projects in dropdown: Empty/NULL project values appeared in the project filter dropdown
Technical Improvements:
- Combined two separate useEffect hooks into one for guaranteed execution order (reset → load)
- Removed redundant filter change detection logic (DRY principle)
- Simplified validation in
mergeAndDeduplicateByProjectfunction - Added
investigatedfield to Summary interface for better session tracking
Files Changed:
src/ui/viewer/App.tsx- Fixed filter change detection and data reset logicsrc/ui/viewer/hooks/usePagination.ts- Improved offset and state ref handlingsrc/ui/viewer/utils/data.ts- Simplified validation logicsrc/services/sqlite/SessionStore.ts- Filter NULL/empty projects from dropdownsrc/ui/viewer/types.ts- Added investigated field to Summary interfacesrc/ui/viewer/components/SummaryCard.tsx- Display investigated field
All changes follow CLAUDE.md coding standards: DRY, YAGNI, and fail-fast error handling.
Testing
Verified fixes work correctly:
- ✅ Select project from dropdown → Data loads immediately
- ✅ Switch between multiple projects → Only selected project's data shown (no mixing)
- ✅ Rapid switching between projects → No race conditions or stale data
- ✅ Switch back to "All Projects" → All data appears correctly with SSE updates
🤖 Generated with Claude Code