@@ -13,6 +13,7 @@ import {getDecodedTagName} from '@libs/TagUtils';
1313import { getTagForDisplay } from '@libs/TransactionUtils' ;
1414
1515import ONYXKEYS from '@src/ONYXKEYS' ;
16+ import type { Policy } from '@src/types/onyx' ;
1617
1718import React from 'react' ;
1819
@@ -21,16 +22,19 @@ import type TransactionDataCellProps from './TransactionDataCellProps';
2122type TagCellProps = TransactionDataCellProps &
2223 EditableProps < string > & {
2324 policyID ?: string ;
25+ policy ?: Policy ;
2426 } ;
2527
26- function TagCell ( { canEdit, onSave, shouldUseNarrowLayout, shouldShowTooltip, transactionItem, policyID} : TagCellProps ) {
28+ function TagCell ( { canEdit, onSave, shouldUseNarrowLayout, shouldShowTooltip, transactionItem, policyID, policy : policyProp } : TagCellProps ) {
2729 const icons = useMemoizedLazyExpensifyIcons ( [ 'Tag' ] ) ;
2830 const styles = useThemeStyles ( ) ;
2931
30- const [ policy ] = useOnyx ( `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` ) ;
32+ const [ livePolicy ] = useOnyx ( `${ ONYXKEYS . COLLECTION . POLICY } ${ policyID } ` ) ;
3133 const [ policyTags ] = useOnyx ( `${ ONYXKEYS . COLLECTION . POLICY_TAGS } ${ policyID } ` ) ;
34+ const policy = livePolicy ? { ...policyProp , ...livePolicy } : policyProp ;
3235
3336 const policyHasDependentTags = hasDependentTags ( policy , policyTags ) ;
37+ const shouldShowGLCode = ! ! policy ?. showTagGLCodes && ! ! policy ?. glCodes ;
3438
3539 const { isEditing, anchorRef, isPopoverVisible, popoverPosition, isInverted, startEditing, cancelEditing, handleSave} = usePopoverEditState ( {
3640 canEdit,
@@ -69,6 +73,7 @@ function TagCell({canEdit, onSave, shouldUseNarrowLayout, shouldShowTooltip, tra
6973 selectedTag = { transactionItem ?. tag ?? '' }
7074 transactionTag = { transactionItem ?. tag }
7175 hasDependentTags = { policyHasDependentTags }
76+ shouldShowGLCode = { shouldShowGLCode }
7277 isVisible = { isPopoverVisible }
7378 onClose = { cancelEditing }
7479 anchorPosition = { popoverPosition }
0 commit comments