@@ -5,7 +5,7 @@ import useLocalize from '@hooks/useLocalize';
55import useOnyx from '@hooks/useOnyx' ;
66import useThemeStyles from '@hooks/useThemeStyles' ;
77import { getHeaderMessageForNonUserList } from '@libs/OptionsListUtils' ;
8- import { getCountOfEnabledTagsOfList , getTagList } from '@libs/PolicyUtils' ;
8+ import { getTagList } from '@libs/PolicyUtils' ;
99import type { OptionData } from '@libs/ReportUtils' ;
1010import type { SelectedTagOption } from '@libs/TagsOptionsListUtils' ;
1111import { getTagListSections } from '@libs/TagsOptionsListUtils' ;
@@ -64,10 +64,6 @@ function TagPicker({
6464
6565 const policyRecentlyUsedTagsList = useMemo ( ( ) => policyRecentlyUsedTags ?. [ tagListName ] ?? [ ] , [ policyRecentlyUsedTags , tagListName ] ) ;
6666 const policyTagList = getTagList ( policyTags , tagListIndex ) ;
67- const policyTagsCount = getCountOfEnabledTagsOfList ( policyTagList . tags ) ;
68- const isTagsCountBelowThreshold = policyTagsCount < CONST . STANDARD_LIST_ITEM_LIMIT ;
69-
70- const shouldShowTextInput = ! isTagsCountBelowThreshold ;
7167
7268 const selectedOptions : SelectedTagOption [ ] = useMemo ( ( ) => {
7369 if ( ! selectedTag ) {
@@ -110,6 +106,11 @@ function TagPicker({
110106 return [ ...selectedOptions , ...Object . values ( policyTagList . tags ) . filter ( ( policyTag ) => policyTag . enabled && ! selectedNames . includes ( policyTag . name ) ) ] ;
111107 } , [ shouldShowDisabledAndSelectedOption , hasDependentTags , selectedOptions , policyTagList . tags , transactionTag , tagListIndex ] ) ;
112108
109+ const availableTagsCount = Array . isArray ( enabledTags ) ? enabledTags . length : Object . keys ( enabledTags ) . length ;
110+ const isTagsCountBelowThreshold = availableTagsCount < CONST . STANDARD_LIST_ITEM_LIMIT ;
111+
112+ const shouldShowTextInput = ! isTagsCountBelowThreshold ;
113+
113114 const sections = useMemo ( ( ) => {
114115 const tagSections = getTagListSections ( {
115116 searchValue,
0 commit comments