File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 1- import React , { useMemo } from 'react' ;
1+ import React , { useMemo , useState } from 'react' ;
22import type { SectionListData } from 'react-native' ;
33import useDebouncedState from '@hooks/useDebouncedState' ;
44import { useMemoizedLazyIllustrations } from '@hooks/useLazyAsset' ;
@@ -84,7 +84,7 @@ function ApproverSelectionList({
8484 const shouldShowTextInput = shouldShowTextInputProp ?? allApprovers ?. length >= CONST . STANDARD_LIST_ITEM_LIMIT ;
8585 const lazyIllustrations = useMemoizedLazyIllustrations ( [ 'TurtleInShell' ] ) ;
8686
87- const selectedMembers = useMemo ( ( ) => allApprovers . filter ( ( approver ) => approver . isSelected ) , [ allApprovers ] ) ;
87+ const [ selectedMembers , setSelectedMembers ] = useState < SelectionListApprover [ ] > ( [ ] ) ;
8888
8989 // eslint-disable-next-line rulesdir/no-negated-variables
9090 const shouldShowNotFoundView = ( isEmptyObject ( policy ) && ! isLoadingReportData ) || ! isPolicyAdmin ( policy ) || isPendingDeletePolicy ( policy ) || shouldShowNotFoundViewProp ;
@@ -117,6 +117,7 @@ function ApproverSelectionList({
117117 ? selectedMembers . filter ( ( selectedOption ) => selectedOption . login !== member . login )
118118 : [ ...selectedMembers , { ...member , isSelected : true } ] ;
119119 }
120+ setSelectedMembers ( newSelectedApprovers ) ;
120121 if ( onSelectApprover ) {
121122 onSelectApprover ( newSelectedApprovers ) ;
122123 }
You can’t perform that action at this time.
0 commit comments