-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[$250] Investigate: 💥 Crash 💥 anonymous
#11766
Comments
Triggered auto assignment to @maddylewis ( |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane ( |
Triggered auto assignment to @sketchydroide ( |
anonymous
anonymous
Proposal App/src/libs/ReportActionsUtils.js Lines 76 to 95 in 9b15fbc
Lines 105 to 112 in 9b15fbc
Lines 122 to 128 in 9b15fbc
App/src/pages/home/report/ReportActionItem.js Lines 129 to 138 in 9b15fbc
Solution From bb77413433d3277386a92ffe196c1d57c1b1951a Mon Sep 17 00:00:00 2001
From: Hans <hungvu193@users.noreply.github.com>
Date: Wed, 12 Oct 2022 23:40:26 +0700
Subject: [PATCH] add action name null safety
---
src/libs/ReportActionsUtils.js | 4 ++++
src/libs/ReportUtils.js | 6 ++++++
src/pages/home/report/ContextMenu/ContextMenuActions.js | 2 +-
src/pages/home/report/ReportActionItem.js | 8 +++++---
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/libs/ReportActionsUtils.js b/src/libs/ReportActionsUtils.js
index 6616d0351..0faed5e3a 100644
--- a/src/libs/ReportActionsUtils.js
+++ b/src/libs/ReportActionsUtils.js
@@ -83,6 +83,10 @@ function isConsecutiveActionMadeByPreviousActor(reportActions, actionIndex) {
return false;
}
+ if (!currentAction.action || !previousAction.action) {
+ return false;
+ }
+
// Comments are only grouped if they happen within 5 minutes of each other
if (currentAction.action.timestamp - previousAction.action.timestamp > 300) {
return false;
diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js
index 94bf06fc2..726aa04c1 100644
--- a/src/libs/ReportUtils.js
+++ b/src/libs/ReportUtils.js
@@ -103,6 +103,9 @@ function sortReportsByLastVisited(reports) {
* @returns {Boolean}
*/
function canEditReportAction(reportAction) {
+ if (!reportAction) {
+ return false;
+ }
return reportAction.actorEmail === sessionEmail
&& reportAction.reportActionID
&& reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT
@@ -120,6 +123,9 @@ function canEditReportAction(reportAction) {
* @returns {Boolean}
*/
function canDeleteReportAction(reportAction) {
+ if (!reportAction) {
+ return false;
+ }
return reportAction.actorEmail === sessionEmail
&& reportAction.reportActionID
&& reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT
diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js
index 7d84a9b31..0a83dbd84 100644
--- a/src/pages/home/report/ContextMenu/ContextMenuActions.js
+++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js
@@ -88,7 +88,7 @@ export default [
icon: Expensicons.Clipboard,
successTextTranslateKey: 'reportActionContextMenu.copied',
successIcon: Expensicons.Checkmark,
- shouldShow: (type, reportAction) => (type === CONTEXT_MENU_TYPES.REPORT_ACTION
+ shouldShow: (type, reportAction) => (type === CONTEXT_MENU_TYPES.REPORT_ACTION && !!reportAction
&& reportAction.actionName !== CONST.REPORT.ACTIONS.TYPE.IOU
&& !ReportUtils.isReportMessageAttachment(_.last(lodashGet(reportAction, ['message'], [{}])))),
diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index 6c6a85269..b4b21edf6 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -126,15 +126,17 @@ class ReportActionItem extends Component {
}
render() {
- if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) {
+ const actionName = lodashGet(this.props, 'action.actionName', '');
+
+ if (actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) {
return <ReportActionItemCreated reportID={this.props.report.reportID} />;
}
- if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.RENAMED) {
+ if (actionName === CONST.REPORT.ACTIONS.TYPE.RENAMED) {
return <RenameAction action={this.props.action} />;
}
let children;
- if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU) {
+ if (actionName === CONST.REPORT.ACTIONS.TYPE.IOU) {
children = (
<IOUAction
chatReportID={this.props.report.reportID}
--
2.31.0
|
This is duplicated with #11754 and will be fixed internally. So can be closed |
Yes. It looks similar. We can close this issue as the fix is already deployed to staging. |
based on #11766 (comment), closing! |
Firebase has reported a new crash that we need to fix, here are all the details we found:
Non-fatal Exception: JavaScriptError
Cannot read property 'actionName' of undefined
main.jsbundle:1693:1257 line 1693
anonymous
Number of Crashes: 19
Device Information
1.2.13-2
,1.2.13.2
,1.2.21-4
,1.2.25.0
Stacktraces
iOS 1.2.25.0
iOS 1.2.25.0
iOS 1.2.25.0
Android 1.2.21-4
Android 1.2.13-2
iOS 1.2.13.2
Internal Firebase Info
💥 DO NOT EDIT THIS SECTION 💥
Crash IDs:
fd1cdb4e916b7497e85f0e22ad937c6e
,29f5a4afa1f0968901244363906bf119
,0c9127e6df526e091a2c1234b473af9b
,687215b1c83475a4093a48662b02c853
,0c1548b4c6419659a1549900f4f1180a
,c3295e2f33bd1e110d971c0a7f959cf0
Exception:
Cannot read property 'actionName' of undefined
REMINDER: Typically, Firebase Crashlytics issues should be capped at $500.
The text was updated successfully, but these errors were encountered: