Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix: only sync with selected collection

httpjamesmdcfb61514ee6
diff --git a/apps/cast/src/pages/slideshow.tsx b/apps/cast/src/pages/slideshow.tsx
index 535439c0c4..f6838276d3 100644
--- a/apps/cast/src/pages/slideshow.tsx
+++ b/apps/cast/src/pages/slideshow.tsx
@@ -3,7 +3,7 @@ import Theatre from 'components/Theatre';
import { FILE_TYPE } from 'constants/file';
import { useRouter } from 'next/router';
import { createContext, useEffect, useState } from 'react';
-import { syncCollections } from 'services/collectionService';
+import { getCollection } from 'services/collectionService';
import { syncFiles } from 'services/fileService';
import { EnteFile } from 'types/file';
import { downloadFileAsBlob, isRawFileFromFileName } from 'utils/file';
@@ -26,29 +26,18 @@ export default function Slideshow() {
>({});
const init = async () => {
- try {
- const collections = await syncCollections();
-
- // get requested collection id from localStorage
- const requestedCollectionID =
- window.localStorage.getItem('targetCollectionId');
+ // get requested collection id from localStorage
+ const requestedCollectionID =
+ window.localStorage.getItem('targetCollectionId');
- const files = await syncFiles('normal', collections, () => {});
+ const collection = await getCollection(Number(requestedCollectionID));
- if (requestedCollectionID) {
- const collectionFiles = files.filter(
- (file) =>
- file.collectionID === Number(requestedCollectionID)
- );
+ const files = await syncFiles('normal', [collection], () => {});
- setCollectionFiles(
- collectionFiles.filter((file) =>
- isFileEligibleForCast(file)
- )
- );
- }
- } catch {
- router.push('/');
+ if (requestedCollectionID) {
+ setCollectionFiles(
+ files.filter((file) => isFileEligibleForCast(file))
+ );
}
};