Context
Shared foundation for the Bulk Report PDF Export and Improve Report Export
Realtime Delivery projects. No user-visible changes — nothing renders yet.
Changes
src/types/onyx/ExportDownload.ts (new file)
- Discriminated union type.
reportCount and failedReportCount are optional
even in the ready state — present for PDF exports, absent for CSV exports
src/CONST/index.ts
- Add
EXPORT_DOWNLOAD: { STATE: { PREPARING, READY, FAILED } } constants
src/ONYXKEYS.ts
- Add
EXPORT_DOWNLOAD: 'nvp_exportDownload_' to the COLLECTION object
- Map to
OnyxTypes.ExportDownload in OnyxCollectionValuesMapping
src/libs/API/types.ts
- Add
SEND_EXPORT_FILE_FROM_CONCIERGE and CLEAR_EXPORT_DOWNLOAD to
WRITE_COMMANDS
- Add
SendExportFileFromConciergeParams and ClearExportDownloadParams,
each with {exportID: string}
- Map them in
WriteCommandParameters
src/libs/actions/Export.ts (new file)
sendExportFileFromConcierge(exportID) — optimistically merges
{shouldSendFromConcierge: true}, calls
API.write(SEND_EXPORT_FILE_FROM_CONCIERGE, {exportID})
clearExportDownload(exportID) — optimistically sets Onyx key to null,
calls API.write(CLEAR_EXPORT_DOWNLOAD, {exportID})
clearStaleExportDownloads() — iterates
ONYXKEYS.COLLECTION.EXPORT_DOWNLOAD and calls clearExportDownload
for each entry found
src/libs/Navigation/AppNavigator/AuthScreensInitHandler.tsx
- Call
Export.clearStaleExportDownloads() alongside existing
Download.clearDownloads()
Testing
Unit tests in tests/unit/ExportActionsTest.ts:
sendExportFileFromConcierge merges {shouldSendFromConcierge: true} into
the correct Onyx key
sendExportFileFromConcierge failureData clears Onyx key
clearExportDownload sets Onyx key to null
clearStaleExportDownloads calls clearExportDownload for each non-null
entry in the collection
Issue Owner
Current Issue Owner: @truph01
Context
Shared foundation for the Bulk Report PDF Export and Improve Report Export
Realtime Delivery projects. No user-visible changes — nothing renders yet.
Changes
src/types/onyx/ExportDownload.ts(new file)reportCountandfailedReportCountare optionaleven in the ready state — present for PDF exports, absent for CSV exports
src/CONST/index.tsEXPORT_DOWNLOAD: { STATE: { PREPARING, READY, FAILED } }constantssrc/ONYXKEYS.tsEXPORT_DOWNLOAD: 'nvp_exportDownload_'to theCOLLECTIONobjectOnyxTypes.ExportDownloadinOnyxCollectionValuesMappingsrc/libs/API/types.tsSEND_EXPORT_FILE_FROM_CONCIERGEandCLEAR_EXPORT_DOWNLOADtoWRITE_COMMANDSSendExportFileFromConciergeParamsandClearExportDownloadParams,each with
{exportID: string}WriteCommandParameterssrc/libs/actions/Export.ts(new file)sendExportFileFromConcierge(exportID)— optimistically merges{shouldSendFromConcierge: true}, callsAPI.write(SEND_EXPORT_FILE_FROM_CONCIERGE, {exportID})clearExportDownload(exportID)— optimistically sets Onyx key to null,calls
API.write(CLEAR_EXPORT_DOWNLOAD, {exportID})clearStaleExportDownloads()— iteratesONYXKEYS.COLLECTION.EXPORT_DOWNLOADand callsclearExportDownloadfor each entry found
src/libs/Navigation/AppNavigator/AuthScreensInitHandler.tsxExport.clearStaleExportDownloads()alongside existingDownload.clearDownloads()Testing
Unit tests in
tests/unit/ExportActionsTest.ts:sendExportFileFromConciergemerges{shouldSendFromConcierge: true}intothe correct Onyx key
sendExportFileFromConciergefailureData clears Onyx keyclearExportDownloadsets Onyx key to nullclearStaleExportDownloadscallsclearExportDownloadfor each non-nullentry in the collection
Issue Owner
Current Issue Owner: @truph01