@@ -60,6 +60,7 @@ const ManagementPlanAccordion: React.FC<Props> = ({
6060 const [ expanded , setExpanded ] = useState ( false ) ;
6161
6262 const [ isAnyRowEditing , setIsAnyRowEditing ] = useState ( false ) ;
63+ const [ isEditingPlanName , setIsEditingPlanName ] = useState ( false ) ;
6364 const [ showEditingError , setShowEditingError ] = useState ( false ) ;
6465 const [ conditionAttributeError , setConditionAttributeError ] = useState ( false ) ;
6566 const [ isConsultationRequired , setIsConsultationRequired ] = useState ( false ) ;
@@ -180,6 +181,7 @@ const ManagementPlanAccordion: React.FC<Props> = ({
180181 setPlanNameError ( false ) ;
181182 setConditionAttributeError ( false ) ;
182183 handleUpdatePlan ( { name : trimmedName } , ( ) => setEditMode ( false ) ) ;
184+ setIsEditingPlanName ( false ) ;
183185 } ;
184186
185187 useEffect ( ( ) => {
@@ -217,7 +219,7 @@ const ManagementPlanAccordion: React.FC<Props> = ({
217219 e . stopPropagation ( ) ;
218220 e . preventDefault ( ) ;
219221
220- if ( isAnyRowEditing ) {
222+ if ( isAnyRowEditing || isEditingPlanName ) {
221223 setShowEditingError ( true ) ;
222224 return ;
223225 }
@@ -380,6 +382,7 @@ const ManagementPlanAccordion: React.FC<Props> = ({
380382 e . stopPropagation ( ) ; // Prevent accordion toggle
381383 e . preventDefault ( ) ;
382384 setEditMode ( true ) ;
385+ setIsEditingPlanName ( true ) ;
383386 } }
384387 sx = { {
385388 height : "28px" ,
@@ -486,6 +489,7 @@ const ManagementPlanAccordion: React.FC<Props> = ({
486489 isApproved = { attributes . is_approved }
487490 isAnyRowEditing = { isAnyRowEditing }
488491 showEditingError = { showEditingError }
492+ isEditingPlanName = { isEditingPlanName }
489493 onApprove = { handleApprovePlan }
490494 label = {
491495 attributes . is_approved
0 commit comments