@@ -88,68 +88,68 @@ function IOURequestStepCategoryCreate({
8888 } = useOnboardingTaskInformation ( CONST . ONBOARDING_TASK_TYPE . SETUP_CATEGORIES_AND_TAGS ) ;
8989
9090 const createCategory = ( values : FormOnyxValues < typeof ONYXKEYS . FORMS . WORKSPACE_CATEGORY_FORM > ) => {
91- const categoryName = values . categoryName . trim ( ) ;
92-
93- if ( ! policyID ) {
94- return ;
95- }
96-
97- // 1. Create the category in the workspace (optimistic update, queued API call).
98- createPolicyCategory ( {
99- policyID,
100- categoryName,
101- isSetupCategoriesTaskParentReportArchived : isSetupCategoryTaskParentReportArchived ,
102- setupCategoryTaskReport,
103- setupCategoryTaskParentReport,
104- currentUserAccountID : currentUserPersonalDetails . accountID ,
105- hasOutstandingChildTask,
106- parentReportAction,
107- setupCategoriesAndTagsTaskReport,
108- setupCategoriesAndTagsTaskParentReport,
109- isSetupCategoriesAndTagsTaskParentReportArchived,
110- setupCategoriesAndTagsHasOutstandingChildTask,
111- setupCategoriesAndTagsParentReportAction,
112- policyHasTags,
91+ const categoryName = values . categoryName . trim ( ) ;
92+
93+ if ( ! policyID ) {
94+ return ;
95+ }
96+
97+ // 1. Create the category in the workspace (optimistic update, queued API call).
98+ createPolicyCategory ( {
99+ policyID,
100+ categoryName,
101+ isSetupCategoriesTaskParentReportArchived : isSetupCategoryTaskParentReportArchived ,
102+ setupCategoryTaskReport,
103+ setupCategoryTaskParentReport,
104+ currentUserAccountID : currentUserPersonalDetails . accountID ,
105+ hasOutstandingChildTask,
106+ parentReportAction,
107+ setupCategoriesAndTagsTaskReport,
108+ setupCategoriesAndTagsTaskParentReport,
109+ isSetupCategoriesAndTagsTaskParentReportArchived,
110+ setupCategoriesAndTagsHasOutstandingChildTask,
111+ setupCategoriesAndTagsParentReportAction,
112+ policyHasTags,
113+ } ) ;
114+
115+ // 2. Apply the newly created category to the transaction.
116+ const policyCategoriesWithNewCategory = {
117+ ...policyCategories ,
118+ [ categoryName ] : {
119+ name : categoryName ,
120+ enabled : true ,
121+ errors : null ,
122+ pendingAction : CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD ,
123+ } ,
124+ } ;
125+
126+ if ( isEditingSplit && transaction ) {
127+ setDraftSplitTransaction ( transaction . transactionID , splitDraftTransaction , { category : categoryName } , policy ) ;
128+ } else if ( isEditing && report ) {
129+ updateMoneyRequestCategory ( {
130+ transactionID : transaction ?. transactionID ?? transactionID ,
131+ transactionThreadReport : report ,
132+ parentReport,
133+ parentReportNextStep,
134+ category : categoryName ,
135+ policy,
136+ policyTagList : policyTags ,
137+ policyCategories : policyCategoriesWithNewCategory ,
138+ policyRecentlyUsedCategories,
139+ currentUserAccountIDParam : currentUserPersonalDetails . accountID ,
140+ currentUserEmailParam : currentUserPersonalDetails . login ?? '' ,
141+ isASAPSubmitBetaEnabled,
142+ hash : currentSearchHash ,
113143 } ) ;
114-
115- // 2. Apply the newly created category to the transaction.
116- const policyCategoriesWithNewCategory = {
117- ...policyCategories ,
118- [ categoryName ] : {
119- name : categoryName ,
120- enabled : true ,
121- errors : null ,
122- pendingAction : CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD ,
123- } ,
124- } ;
125-
126- if ( isEditingSplit && transaction ) {
127- setDraftSplitTransaction ( transaction . transactionID , splitDraftTransaction , { category : categoryName } , policy ) ;
128- } else if ( isEditing && report ) {
129- updateMoneyRequestCategory ( {
130- transactionID : transaction ?. transactionID ?? transactionID ,
131- transactionThreadReport : report ,
132- parentReport,
133- parentReportNextStep,
134- category : categoryName ,
135- policy,
136- policyTagList : policyTags ,
137- policyCategories : policyCategoriesWithNewCategory ,
138- policyRecentlyUsedCategories,
139- currentUserAccountIDParam : currentUserPersonalDetails . accountID ,
140- currentUserEmailParam : currentUserPersonalDetails . login ?? '' ,
141- isASAPSubmitBetaEnabled,
142- hash : currentSearchHash ,
143- } ) ;
144- } else {
145- setMoneyRequestCategory ( transactionID , categoryName , policy ) ;
146- }
147-
148- if ( ! isEditing && action === CONST . IOU . ACTION . CATEGORIZE && ! backTo ) {
149- Navigation . navigate ( ROUTES . MONEY_REQUEST_STEP_CONFIRMATION . getRoute ( action , iouType , transactionID , report ?. reportID ?? reportID ) ) ;
150- return ;
151- }
152- Navigation . goBack ( backTo ) ;
144+ } else {
145+ setMoneyRequestCategory ( transactionID , categoryName , policy ) ;
146+ }
147+
148+ if ( ! isEditing && action === CONST . IOU . ACTION . CATEGORIZE && ! backTo ) {
149+ Navigation . navigate ( ROUTES . MONEY_REQUEST_STEP_CONFIRMATION . getRoute ( action , iouType , transactionID , report ?. reportID ?? reportID ) ) ;
150+ return ;
151+ }
152+ Navigation . goBack ( backTo ) ;
153153 } ;
154154
155155 return (
0 commit comments