Skip to content

Commit

Permalink
Merge pull request #26265 from situchan/fix/26209
Browse files Browse the repository at this point in the history
fix crash when clicking UP key from keyboard after requesting money

(cherry picked from commit a4ff80a)
  • Loading branch information
luacmartins authored and OSBotify committed Aug 30, 2023
1 parent 2d2e5d0 commit 16487fc
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit 16487fc

Please sign in to comment.