File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import type {OnyxEntry} from 'react-native-onyx';
22import Onyx from 'react-native-onyx' ;
33import { write } from '@libs/API' ;
44import { WRITE_COMMANDS } from '@libs/API/types' ;
5+ import CONST from '@src/CONST' ;
56import ONYXKEYS from '@src/ONYXKEYS' ;
67import type ExportDownload from '@src/types/onyx/ExportDownload' ;
78import 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 } ) ;
You can’t perform that action at this time.
0 commit comments