Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function SelectionToolbar({reportID, transactions, reportActions}: SelectionTool

const isMobileSelectionModeEnabled = useMobileSelectionMode();
const {showConfirmModal} = useConfirmModal();
const {trackExport, exportDownloadStatusModal} = useExportDownloadStatusModal(() => clearSelectedTransactions(undefined, true));
const {trackExport, exportDownloadStatusModal} = useExportDownloadStatusModal(() => clearSelectedTransactions(true));

const [offlineModalVisible, setOfflineModalVisible] = useState(false);
const [isDownloadErrorModalVisible, setIsDownloadErrorModalVisible] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useExportActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function useExportActions({reportID, policy, onPDFModalOpen}: UseExportActionsPa
const {showDecisionModal} = useDecisionModal();
const {triggerExportOrConfirm} = useExportAgainModal(moneyRequestReport?.reportID, moneyRequestReport?.policyID);
const {clearSelectedTransactions} = useSearchSelectionActions();
const {trackExport, exportDownloadStatusModal} = useExportDownloadStatusModal(() => clearSelectedTransactions(undefined, true));
const {trackExport, exportDownloadStatusModal} = useExportDownloadStatusModal(() => clearSelectedTransactions(true));

const expensifyIcons = useMemoizedLazyExpensifyIcons([
'Table',
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/hooks/useExportActionsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,21 @@ describe('useExportActions - template export status modal', () => {
expect(mockClearExportDownload).toHaveBeenCalledWith('mock-export-id', undefined);
expect(result.current.exportDownloadStatusModal).toBeNull();
});

it('clears the report-view selection with the boolean flag when the status modal is dismissed', () => {
const {result} = renderHook(() => useExportActions({reportID: REPORT_ID}));

act(() => {
result.current.beginExportWithTemplate('Test Template', 'csv', ['1'], EXPORT_NAME, POLICY_ID);
});
const modal: ReactElement<ExportDownloadStatusModalProps> | null = result.current.exportDownloadStatusModal;

act(() => {
modal?.props.onClose();
});

// The cleanup callback must call clearSelectedTransactions with the boolean `true` (not `(undefined, true)`),
// because the selection API only resets the report-view selection when the first argument is a boolean.
expect(mockClearSelectedTransactions).toHaveBeenCalledWith(true);
});
});
Loading