feat: Implement offline library synchronization with IndexedDB
- Added `useOfflineLibrarySync` hook for managing offline library sync operations. - Created `OfflineLibrarySync` component for UI integration. - Developed `offlineLibraryDB` for IndexedDB interactions, including storing and retrieving albums, artists, songs, and playlists. - Implemented sync operations for starred items, playlists, and scrobbling. - Added auto-sync functionality when coming back online. - Included metadata management for sync settings and statistics. - Enhanced error handling and user feedback through toasts.
This commit is contained in:
@@ -95,16 +95,16 @@ export function CacheManagement() {
|
||||
});
|
||||
};
|
||||
|
||||
const loadOfflineItems = useCallback(() => {
|
||||
const loadOfflineItems = useCallback(async () => {
|
||||
if (isOfflineInitialized) {
|
||||
const items = getOfflineItems();
|
||||
const items = await getOfflineItems();
|
||||
setOfflineItems(items);
|
||||
}
|
||||
}, [isOfflineInitialized, getOfflineItems]);
|
||||
|
||||
useEffect(() => {
|
||||
loadCacheStats();
|
||||
loadOfflineItems();
|
||||
loadCacheStats();
|
||||
loadOfflineItems();
|
||||
|
||||
// Load offline mode settings
|
||||
const storedOfflineMode = localStorage.getItem('offline-mode-enabled');
|
||||
|
||||
Reference in New Issue
Block a user