Skip to content

[Due for payment 2026-05-29] Add ExportDownload Onyx foundation and shared export action functions #90295

Description

@mollfpr

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 OwnerCurrent Issue Owner: @mallenexpensify

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions