feat: Refactor service worker registration and enhance offline download manager with client-side checks

This commit is contained in:
2025-08-11 12:31:08 +00:00
committed by GitHub
parent 452af2f6f0
commit 8b5dbbe854
4 changed files with 116 additions and 13 deletions

View File

@@ -19,9 +19,12 @@ export interface OfflineLibraryState {
}
export function useOfflineLibrary() {
// Check if we're on the client side
const isClient = typeof window !== 'undefined';
const [state, setState] = useState<OfflineLibraryState>({
isInitialized: false,
isOnline: navigator.onLine,
isOnline: isClient ? navigator.onLine : true, // Default to true during SSR
isSyncing: false,
lastSync: null,
stats: {