remove files of deleted collections
This commit is contained in:
parent
72fab5db92
commit
5c5a161999
|
@ -78,7 +78,11 @@ export const fetchFiles = async (
|
||||||
let files = await localFiles();
|
let files = await localFiles();
|
||||||
const collectionUpdationTime = new Map<string, string>();
|
const collectionUpdationTime = new Map<string, string>();
|
||||||
let fetchedFiles = [];
|
let fetchedFiles = [];
|
||||||
|
let deletedCollection = new Set<string>();
|
||||||
for (let collection of collections) {
|
for (let collection of collections) {
|
||||||
|
if (collection.isDeleted) {
|
||||||
|
deletedCollection.add(collection.id);
|
||||||
|
}
|
||||||
const files = await getFiles(collection, null, 100, token);
|
const files = await getFiles(collection, null, 100, token);
|
||||||
fetchedFiles.push(...files);
|
fetchedFiles.push(...files);
|
||||||
collectionUpdationTime.set(collection.id, files.length > 0 ? files.slice(-1)[0].updationTime.toString() : "0");
|
collectionUpdationTime.set(collection.id, files.length > 0 ? files.slice(-1)[0].updationTime.toString() : "0");
|
||||||
|
@ -93,9 +97,10 @@ export const fetchFiles = async (
|
||||||
});
|
});
|
||||||
files = [];
|
files = [];
|
||||||
for (const [_, file] of latestFiles) {
|
for (const [_, file] of latestFiles) {
|
||||||
if (!file.isDeleted)
|
if (!(file.isDeleted || deletedCollection.has(file.collectionID.toString()))) {
|
||||||
files.push(file);
|
files.push(file);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
files = files.sort(
|
files = files.sort(
|
||||||
(a, b) => b.metadata.creationTime - a.metadata.creationTime
|
(a, b) => b.metadata.creationTime - a.metadata.creationTime
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue