11import { Str } from 'expensify-common' ;
22import { useContext } from 'react' ;
3- import type { RefObject } from 'react' ;
43import type { OnyxEntry } from 'react-native-onyx' ;
54import { usePersonalDetails } from '@components/OnyxListItemProvider' ;
65import useAncestors from '@hooks/useAncestors' ;
@@ -25,16 +24,10 @@ import {ActionListContext} from '@pages/inbox/ReportScreenContext';
2524import CONST from '@src/CONST' ;
2625import ONYXKEYS from '@src/ONYXKEYS' ;
2726import type * as OnyxTypes from '@src/types/onyx' ;
28- import type { FileObject } from '@src/types/utils/Attachment ' ;
27+ import { useComposerMeta } from './ComposerContext ' ;
2928import useSidePanelContext from './useSidePanelContext' ;
3029
31- type UseComposerSubmitParams = {
32- report : OnyxEntry < OnyxTypes . Report > ;
33- reportID : string ;
34- attachmentFileRef : RefObject < FileObject | FileObject [ ] | null > ;
35- } ;
36-
37- function useComposerSubmit ( { report, reportID, attachmentFileRef} : UseComposerSubmitParams ) : ( comment : string ) => void {
30+ function useComposerSubmit ( reportID : string ) : ( comment : string ) => void {
3831 const { isOffline} = useNetwork ( ) ;
3932 const currentUserPersonalDetails = useCurrentUserPersonalDetails ( ) ;
4033 const personalDetails = usePersonalDetails ( ) ;
@@ -43,9 +36,11 @@ function useComposerSubmit({report, reportID, attachmentFileRef}: UseComposerSub
4336 const sidePanelContext = useSidePanelContext ( reportID ) ;
4437 const [ quickAction ] = useOnyx ( ONYXKEYS . NVP_QUICK_ACTION_GLOBAL_CREATE ) ;
4538 const delegateAccountID = useDelegateAccountID ( ) ;
39+ const { attachmentFileRef} = useComposerMeta ( ) ;
4640
4741 const { scrollOffsetRef} = useContext ( ActionListContext ) ;
4842
43+ const [ report ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ reportID } ` ) ;
4944 const [ chatReport ] = useOnyx ( `${ ONYXKEYS . COLLECTION . REPORT } ${ report ?. chatReportID } ` ) ;
5045
5146 const { reportActions : unfilteredReportActions } = usePaginatedReportActions ( report ?. reportID ) ;
0 commit comments