Skip to content

Commit 0f44234

Browse files
committed
fix: Clear only for ready or failed
1 parent 951c45b commit 0f44234

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/libs/actions/Export.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type {OnyxEntry} from 'react-native-onyx';
22
import Onyx from 'react-native-onyx';
33
import {write} from '@libs/API';
44
import {WRITE_COMMANDS} from '@libs/API/types';
5+
import CONST from '@src/CONST';
56
import ONYXKEYS from '@src/ONYXKEYS';
67
import type ExportDownload from '@src/types/onyx/ExportDownload';
78
import type {AnyOnyxUpdate} from '@src/types/onyx/Request';
@@ -62,11 +63,12 @@ function clearStaleExportDownloads() {
6263
return;
6364
}
6465
for (const key of Object.keys(exportDownloads)) {
65-
if (!exportDownloads[key]) {
66+
const exportDownload = exportDownloads[key];
67+
if (!exportDownload || exportDownload.state === CONST.EXPORT_DOWNLOAD.STATE.PREPARING) {
6668
continue;
6769
}
6870
const exportID = key.replace(ONYXKEYS.COLLECTION.EXPORT_DOWNLOAD, '');
69-
clearExportDownload(exportID, exportDownloads[key]);
71+
clearExportDownload(exportID, exportDownload);
7072
}
7173
},
7274
});

0 commit comments

Comments
 (0)