- Improved the useEnhancedProcessedFiles hook to only update processed files when content changes.
- Added preview functionality for split PDF files in the HomePage component.
- Implemented a new PDFExportService with enhanced error handling and file validation.
- Updated Split tool to generate and display thumbnails for split PDF files.
- Introduced a comprehensive FileOperationHistory component to track and display file operations.
- Enhanced file context types to support new operation types and history management.
- Created a ZipFileService for validating and extracting PDF files from ZIP archives.
- Changed selectedPages, draggedPage, dropTarget, and movingPage props from string to number type.
- Updated event handlers and state management to reflect the use of page numbers.
- Enhanced logging for better debugging during thumbnail generation and worker communication.
refactor: Simplify FileContext by removing mergedDocuments state and related actions
- Removed mergedDocuments from FileContextState and associated actions in the reducer.
- Updated selectedPageIds to selectedPageNumbers for consistency in page selection handling.
fix: Improve thumbnail generation service logging and error handling
- Added detailed logging for thumbnail generation progress and worker job management.
- Implemented better error handling for worker timeouts and main thread fallbacks.
style: Clean up FileGrid component for better readability and maintainability
- Adjusted formatting and spacing in the FileGrid component for improved code clarity.
Major performance improvements and UX enhancements:
PERFORMANCE FIXES:
- Add merged document caching in FileContext to prevent re-processing on view switches
- Implement hash-based cache fallback for File object identity preservation
- Add pagination for large documents (>200 pages) to prevent DOM overload
- Convert synchronous operations to async chunked processing
- Optimize effect dependencies to prevent unnecessary re-renders
- Remove aggressive cleanup on view switches that destroyed caches
UI/UX IMPROVEMENTS:
- Add immediate visual feedback with loading spinners in view switching buttons
- Implement skeleton loaders for smooth transitions during processing
- Add progress indicators with real-time percentages
- Defer heavy operations using requestAnimationFrame to allow UI updates
- Create reusable SkeletonLoader component for consistent loading states
CACHE SYSTEM:
- Move processed file cache management to FileContext for persistence
- Add stable cache key generation based on file combinations
- Implement smart cache invalidation only when files are actually removed
- Preserve thumbnails and page data across view switches
BUG FIXES:
- Fix infinite loop errors caused by circular hook dependencies
- Resolve File object recreation breaking Map lookups
- Fix thumbnail loading issues in PageEditor
- Prevent UI thread blocking during PDF merging operations
TECHNICAL DEBT:
- Centralize memory management in FileContext
- Add proper cleanup for removed files while preserving active caches
- Implement async/await patterns for better error handling
- Add performance debugging with console timing
Result: PageEditor now loads instantly when returning to cached files,
large documents render smoothly with pagination, and view switching
provides immediate feedback even during heavy operations.