-
Notifications
You must be signed in to change notification settings - Fork 3k
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
add failure message when create a task error #26848
Changes from 13 commits
ac80c64
445b4e0
0ca6752
b88e4db
abff47b
3b1f752
dc17f13
2f3309b
6990da7
da7c3aa
a63d988
07dbcc4
a502733
6159d2d
20319e1
e469980
b2e99ad
4d6c183
fd33516
74c2cf8
8d2d2f2
ce5e88f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,9 +133,13 @@ function createTaskAndNavigate(parentReportID, title, description, assigneeEmail | |
// FOR TASK REPORT | ||
const failureData = [ | ||
{ | ||
onyxMethod: Onyx.METHOD.SET, | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticTaskReport.reportID}`, | ||
value: null, | ||
value: { | ||
errorFields: { | ||
createChat: ErrorUtils.getMicroSecondOnyxError('task.genericCreateTaskFailureMessage'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I checked the backend returns error with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, Can you please tell me how do we determine which key should be used here? It will help me understand this concept better. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's just use a new createTask key.
We mostly just use the action that failed and key it as such. So in this scenario since there was an error creating the task we add the error key on createTask There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @namhihi237 let's get that done please. This is the last change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated |
||
}, | ||
}, | ||
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
|
@@ -186,7 +190,11 @@ function createTaskAndNavigate(parentReportID, title, description, assigneeEmail | |
failureData.push({ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, | ||
value: {[optimisticAddCommentReport.reportAction.reportActionID]: {pendingAction: null}}, | ||
value: { | ||
[optimisticAddCommentReport.reportAction.reportActionID]: { | ||
errors: ErrorUtils.getMicroSecondOnyxError('task.genericCreateTaskFailureMessage'), | ||
}, | ||
}, | ||
}); | ||
|
||
clearOutTaskInfo(); | ||
|
@@ -905,7 +913,21 @@ function canModifyTask(taskReport, sessionAccountID) { | |
/** | ||
* @param {String} reportID | ||
*/ | ||
function clearEditTaskErrors(reportID) { | ||
function clearTaskErrors(reportID) { | ||
const report = ReportUtils.getReport(reportID); | ||
|
||
// Delete the task preview in the parent report | ||
if (lodashGet(report, 'pendingFields.createChat') === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) { | ||
namhihi237 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`, { | ||
[report.parentReportActionID]: null, | ||
}); | ||
|
||
Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, null); | ||
|
||
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.parentReportID)); | ||
namhihi237 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return; | ||
} | ||
|
||
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, { | ||
pendingFields: null, | ||
errorFields: null, | ||
|
@@ -960,7 +982,7 @@ export { | |
cancelTask, | ||
dismissModalAndClearOutTaskInfo, | ||
getTaskAssigneeAccountID, | ||
clearEditTaskErrors, | ||
clearTaskErrors, | ||
canModifyTask, | ||
getTaskReportActionMessage, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a generic function so I am trying to test it with other report actions. This might be applicable to money requests. But I am not sure how to get a failed money request error on action.
Any idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can flow steps: