Skip to content

Commit 2e22952

Browse files
committed
fix ios modal race condition
1 parent 2ab6701 commit 2e22952

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/pages/Search/SearchPage.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ function SearchPage({route}: SearchPageProps) {
111111

112112
const beginExportWithTemplate = useCallback(
113113
(templateName: string, templateType: string, policyID: string | undefined) => {
114-
setIsExportWithTemplateModalVisible(true);
115-
116114
// If the user has selected a large number of items, we'll use the queryJSON to search for the reportIDs and transactionIDs necessary for the export
117115
if (areAllMatchingItemsSelected) {
118116
queueExportSearchWithTemplate({templateName, templateType, jsonQuery: JSON.stringify(queryJSON), reportIDList: [], transactionIDList: [], policyID});
@@ -121,6 +119,8 @@ function SearchPage({route}: SearchPageProps) {
121119
const reportIDList = selectedReports?.filter((report) => !!report).map((report) => report.reportID) ?? [];
122120
queueExportSearchWithTemplate({templateName, templateType, jsonQuery: '{}', reportIDList, transactionIDList: selectedTransactionsKeys, policyID});
123121
}
122+
123+
setIsExportWithTemplateModalVisible(true);
124124
},
125125
[queryJSON, selectedReports, selectedTransactionsKeys, areAllMatchingItemsSelected],
126126
);
@@ -174,6 +174,7 @@ function SearchPage({route}: SearchPageProps) {
174174
beginExportWithTemplate(CONST.REPORT.EXPORT_OPTIONS.EXPENSE_LEVEL_EXPORT, CONST.EXPORT_TEMPLATE_TYPES.INTEGRATIONS, undefined);
175175
},
176176
shouldCloseModalOnSelect: true,
177+
shouldCallAfterModalHide: true,
177178
},
178179
];
179180

@@ -193,6 +194,7 @@ function SearchPage({route}: SearchPageProps) {
193194
beginExportWithTemplate(CONST.REPORT.EXPORT_OPTIONS.REPORT_LEVEL_EXPORT, CONST.EXPORT_TEMPLATE_TYPES.INTEGRATIONS, undefined);
194195
},
195196
shouldCloseModalOnSelect: true,
197+
shouldCallAfterModalHide: true,
196198
});
197199
}
198200

0 commit comments

Comments
 (0)