diff --git a/apps/readest-app/src/hooks/useSync.ts b/apps/readest-app/src/hooks/useSync.ts index d9156ea6..66b11f9b 100644 --- a/apps/readest-app/src/hooks/useSync.ts +++ b/apps/readest-app/src/hooks/useSync.ts @@ -65,7 +65,8 @@ export function useSync(bookKey?: string) { const { syncClient } = useSyncContext(); useEffect(() => { - setIsSyncing(bookKey || '', syncing); + if (!bookKey) return; + setIsSyncing(bookKey, syncing); // eslint-disable-next-line react-hooks/exhaustive-deps }, [bookKey, syncing]); diff --git a/apps/readest-app/src/store/readerStore.ts b/apps/readest-app/src/store/readerStore.ts index 615cbd02..abd8943d 100644 --- a/apps/readest-app/src/store/readerStore.ts +++ b/apps/readest-app/src/store/readerStore.ts @@ -98,7 +98,7 @@ export const useReaderStore = create((set, get) => ({ getViewsById: (id: string) => { const { viewStates } = get(); return Object.values(viewStates) - .filter((state) => state.key.startsWith(id)) + .filter((state) => state.key && state.key.startsWith(id)) .map((state) => state.view!); },