Skip to content

Commit 0f53643

Browse files
committed
revert useComposerSubmit signature; self-subscribe report and attachmentFileRef
1 parent 95dbafa commit 0f53643

3 files changed

Lines changed: 7 additions & 11 deletions

File tree

src/pages/inbox/report/ReportActionCompose/ComposerInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function ComposerInput({reportID}: ComposerInputProps) {
3939
const {isBlockedFromConcierge} = useComposerSendState();
4040
const {setIsFullComposerAvailable, onBlur, onFocus, setComposerRef} = useComposerActions();
4141
const {handleSendMessage, onValueChange} = useComposerSendActions();
42-
const {containerRef, suggestionsRef, isNextModalWillOpenRef, attachmentFileRef} = useComposerMeta();
42+
const {containerRef, suggestionsRef, isNextModalWillOpenRef} = useComposerMeta();
4343

4444
const [isComposerFullSize = false] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${reportID}`);
4545
const [shouldShowComposeInput = true] = useOnyx(ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT);
@@ -54,7 +54,7 @@ function ComposerInput({reportID}: ComposerInputProps) {
5454

5555
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
5656

57-
const submitForm = useComposerSubmit({report, reportID, attachmentFileRef});
57+
const submitForm = useComposerSubmit(reportID);
5858
const {pickAttachments, PDFValidationComponent, ErrorModal} = useAttachmentPicker(reportID);
5959
const isReportArchived = useReportIsArchived(report?.reportID);
6060

src/pages/inbox/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ function ComposerWithSuggestions({
490490
selection?.end,
491491
selection?.start,
492492
currentUserAccountID,
493+
setText,
493494
],
494495
);
495496

src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {Str} from 'expensify-common';
22
import {useContext} from 'react';
3-
import type {RefObject} from 'react';
43
import type {OnyxEntry} from 'react-native-onyx';
54
import {usePersonalDetails} from '@components/OnyxListItemProvider';
65
import useAncestors from '@hooks/useAncestors';
@@ -25,16 +24,10 @@ import {ActionListContext} from '@pages/inbox/ReportScreenContext';
2524
import CONST from '@src/CONST';
2625
import ONYXKEYS from '@src/ONYXKEYS';
2726
import type * as OnyxTypes from '@src/types/onyx';
28-
import type {FileObject} from '@src/types/utils/Attachment';
27+
import {useComposerMeta} from './ComposerContext';
2928
import 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

Comments
 (0)