Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix crash when clicking UP key from keyboard after requesting money #26265

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import usePrevious from '../../../../hooks/usePrevious';
import * as EmojiUtils from '../../../../libs/EmojiUtils';
import * as User from '../../../../libs/actions/User';
import * as ReportUtils from '../../../../libs/ReportUtils';
import * as ReportActionsUtils from '../../../../libs/ReportActionsUtils';
import canFocusInputOnScreenFocus from '../../../../libs/canFocusInputOnScreenFocus';
import debouncedSaveReportComment from '../../../../libs/ComposerUtils/debouncedSaveReportComment';
import SilentCommentUpdater from './SilentCommentUpdater';
Expand Down Expand Up @@ -290,9 +291,11 @@ function ComposerWithSuggestions({

const parentReportActionID = lodashGet(report, 'parentReportActionID', '');
const parentReportAction = lodashGet(parentReportActions, [parentReportActionID], {});
const lastReportAction = _.find([...reportActions, parentReportAction], (action) => ReportUtils.canEditReportAction(action));

if (lastReportAction !== -1 && lastReportAction) {
const lastReportAction = _.find(
[...reportActions, parentReportAction],
(action) => ReportUtils.canEditReportAction(action) && !ReportActionsUtils.isMoneyRequestAction(action),
);
if (lastReportAction) {
Report.saveReportActionDraft(reportID, lastReportAction.reportActionID, _.last(lastReportAction.message).html);
}
}
Expand Down