Skip to content

Commit

Permalink
fix: fix uploadConversationAttachmentsEpic
Browse files Browse the repository at this point in the history
  • Loading branch information
denys-kolomiitsev committed Feb 6, 2024
1 parent d0b9682 commit 7f590bd
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions apps/chat/src/store/import-export/importExport.epics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const importZipEpic: AppEpic = (action$, state$) =>
).pipe(
switchMap((attachmentsToUpload) => {
if (!attachmentsToUpload.length) {
of(ImportExportActions.importFail());
return of(ImportExportActions.importFail());
}
return of(
ImportExportActions.uploadConversationAttachments({
Expand All @@ -243,15 +243,13 @@ const importZipEpic: AppEpic = (action$, state$) =>
}),
);
}),
takeUntil(action$.pipe(filter(ImportExportActions.importStop.match))),
);

const uploadConversationAttachmentsEpic: AppEpic = (action$, state$) =>
action$.pipe(
filter(ImportExportActions.uploadConversationAttachments.match),
switchMap(({ payload }) => {
const { attachmentsToUpload, completeHistory } = payload;

const bucket = FilesSelectors.selectBucket(state$.value);

if (!bucket.length) {
Expand Down Expand Up @@ -309,7 +307,6 @@ const uploadConversationAttachmentsEpic: AppEpic = (action$, state$) =>
percent: percent!,
});
}),
takeUntil(action$.pipe(filter(ImportExportActions.importStop.match))),
catchError(() => {
return of(
ImportExportActions.uploadSingleFileFail({
Expand All @@ -319,8 +316,10 @@ const uploadConversationAttachmentsEpic: AppEpic = (action$, state$) =>
}),
);
});
mergeAll(1);
return concat(...actions);
mergeAll(5);
return concat(...actions).pipe(
takeUntil(action$.pipe(filter(ImportExportActions.importStop.match))),
);
}),
);

Expand Down

0 comments on commit 7f590bd

Please sign in to comment.