@@ -8,11 +8,13 @@ import useImportSpreadsheetConfirmModal from '@hooks/useImportSpreadsheetConfirm
88import useLocalize from '@hooks/useLocalize' ;
99import useNetwork from '@hooks/useNetwork' ;
1010import useOnyx from '@hooks/useOnyx' ;
11+ import usePermissions from '@hooks/usePermissions' ;
1112import usePolicy from '@hooks/usePolicy' ;
1213
1314import { openPolicyCategoriesPage } from '@libs/actions/Policy/Category' ;
1415import type { ImportedMerchantRule } from '@libs/actions/Policy/Rules' ;
1516import { importMerchantRulesSpreadsheet } from '@libs/actions/Policy/Rules' ;
17+ import Tab from '@libs/actions/Tab' ;
1618import { getDecodedCategoryName } from '@libs/CategoryUtils' ;
1719import { findDuplicate , generateColumnNames } from '@libs/importSpreadsheetUtils' ;
1820import Navigation from '@libs/Navigation/Navigation' ;
@@ -133,6 +135,8 @@ function ImportedMerchantRulesPage({route}: ImportedMerchantRulesPageProps) {
133135 const policyID = route . params . policyID ;
134136 const policy = usePolicy ( policyID ) ;
135137 const [ policyCategories ] = useOnyx ( `${ ONYXKEYS . COLLECTION . POLICY_CATEGORIES } ${ policyID } ` ) ;
138+ const { isBetaEnabled} = usePermissions ( ) ;
139+ const isRulesRevampEnabled = isBetaEnabled ( CONST . BETAS . RULES_REVAMP ) ;
136140
137141 // Fetch categories if they're not loaded (e.g. after a cache clear) so imported category cells are
138142 // validated against the policy's real category list instead of an empty one
@@ -193,6 +197,10 @@ function ImportedMerchantRulesPage({route}: ImportedMerchantRulesPageProps) {
193197 const closeImportPageAndModal = ( ) => {
194198 setIsClosing ( true ) ;
195199 setIsImportingRules ( false ) ;
200+ if ( isRulesRevampEnabled ) {
201+ // Import can start from any tab, so land on the one holding the imported rules.
202+ Tab . setSelectedTab ( CONST . TAB . RULES_TAB_TYPE , CONST . TAB . RULES . EXPENSE_DEFAULTS ) ;
203+ }
196204 Navigation . goBack ( ROUTES . WORKSPACE_RULES . getRoute ( policyID ) ) ;
197205 } ;
198206
0 commit comments