fix: critical issues - settings sync, error handling, bookmarks persistence

- Fix settings synchronization: ReadingView now listens to storage events for real-time preference updates
- Add comprehensive error handling to loadChapter with proper state management
- Add comprehensive error handling to loadBooks with booksLoading state
- Add localStorage persistence for bookmarks (load on mount, save on change)
- Display error messages in UI with reload button and proper loading states

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-11 20:29:20 +00:00
parent 1dc4d761b5
commit b8652b9f0a
2 changed files with 89 additions and 32 deletions

View File

@@ -32,7 +32,14 @@ export function ReadingView({
const [showControls, setShowControls] = useState(!isMobile)
useEffect(() => {
const handleStorageChange = () => {
setPreferences(loadPreferences())
}
setPreferences(loadPreferences())
window.addEventListener('storage', handleStorageChange)
return () => window.removeEventListener('storage', handleStorageChange)
}, [])
const cssVars = getCSSVariables(preferences)