Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion apps/mobile/app/hooks/use-app-events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ export const useAppEvents = () => {
initialUrl: string;
backupDidWait: boolean;
isConnectingSSE: boolean;
attachmentsCachedOfflineMode: boolean;
}>
>({});

Expand Down Expand Up @@ -655,7 +656,11 @@ export const useAppEvents = () => {
}
}

if (SettingsService.getProperty("offlineMode")) {
if (
SettingsService.getProperty("offlineMode") &&
!refValues.current.attachmentsCachedOfflineMode
) {
refValues.current.attachmentsCachedOfflineMode = true;
db.attachments.cacheAttachments().catch(() => {
/* empty */
});
Expand Down
22 changes: 20 additions & 2 deletions packages/core/src/database/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ export class FileStorage {
let current = 0;
const token = await this.tokenManager.getAccessToken();
const total = files.length;
const group = this.groups.downloads.get(groupId) || new Set();

if (this.groups.downloads.has(groupId)) {
logger.debug("[queueDownloads] group already exists", {
groupId
});
return this.groups.downloads.get(groupId);
}

const group = new Set<string>();

files.forEach((f) => group.add(f.filename));
this.groups.downloads.set(groupId, group);

Expand Down Expand Up @@ -143,7 +152,16 @@ export class FileStorage {
let current = 0;
const token = await this.tokenManager.getAccessToken();
const total = files.length;
const group = this.groups.uploads.get(groupId) || new Set();

if (this.groups.uploads.has(groupId)) {
logger.debug("[queueUploads] group already exists", {
groupId
});
return this.groups.uploads.get(groupId);
}

const group = new Set<string>();

files.forEach((f) => group.add(f.filename));
this.groups.uploads.set(groupId, group);

Expand Down
Loading