Skip to content

Commit

Permalink
Merge pull request #41727 from bernhardoj/fix/41397-chat-render-delay
Browse files Browse the repository at this point in the history
Fix composer input rendering is delayed
  • Loading branch information
Julesssss authored May 13, 2024
2 parents 393cdfc + 83dc622 commit 90a5028
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
26 changes: 2 additions & 24 deletions src/components/AttachmentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ import SafeAreaConsumer from './SafeAreaConsumer';
type AttachmentModalOnyxProps = {
/** The transaction associated with the receipt attachment, if any */
transaction: OnyxEntry<OnyxTypes.Transaction>;

/** The report associated with the receipt attachment, if any */
parentReport: OnyxEntry<OnyxTypes.Report>;

/** The policy associated with the receipt attachment, if any */
policy: OnyxEntry<OnyxTypes.Policy>;

/** The list of report actions associated with the receipt attachment, if any */
parentReportActions: OnyxEntry<OnyxTypes.ReportActions>;
};

type ImagePickerResponse = {
Expand Down Expand Up @@ -157,10 +148,7 @@ function AttachmentModal({
isWorkspaceAvatar = false,
maybeIcon = false,
transaction,
parentReport,
parentReportActions,
headerTitle,
policy,
children,
fallbackSource,
canEditReceipt = false,
Expand Down Expand Up @@ -413,7 +401,7 @@ function AttachmentModal({
const sourceForAttachmentView = sourceState || source;

const threeDotsMenuItems = useMemo(() => {
if (!isReceiptAttachment || !parentReport || !parentReportActions) {
if (!isReceiptAttachment) {
return [];
}

Expand Down Expand Up @@ -454,7 +442,7 @@ function AttachmentModal({
}
return menuItems;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isReceiptAttachment, parentReport, parentReportActions, policy, transaction, file, sourceState, iouType]);
}, [isReceiptAttachment, transaction, file, sourceState, iouType]);

// There are a few things that shouldn't be set until we absolutely know if the file is a receipt or an attachment.
// props.isReceiptAttachment will be null until its certain what the file is, in which case it will then be true|false.
Expand Down Expand Up @@ -621,16 +609,6 @@ export default withOnyx<AttachmentModalProps, AttachmentModalOnyxProps>({
},
initWithStoredValues: false,
},
parentReport: {
key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT}${report ? report.parentReportID : '0'}`,
},
policy: {
key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report ? report.policyID : '0'}`,
},
parentReportActions: {
key: ({report}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report ? report.parentReportID : '0'}`,
canEvict: false,
},
})(memo(AttachmentModal));

export type {Attachment, FileObject, ImagePickerResponse};
Original file line number Diff line number Diff line change
Expand Up @@ -330,5 +330,6 @@ AttachmentPickerWithMenuItems.displayName = 'AttachmentPickerWithMenuItems';
export default withOnyx<AttachmentPickerWithMenuItemsProps, AttachmentPickerWithMenuItemsOnyxProps>({
policy: {
key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`,
initialValue: {} as OnyxTypes.Policy,
},
})(AttachmentPickerWithMenuItems);

0 comments on commit 90a5028

Please sign in to comment.