Skip to content

Commit 3373fa8

Browse files
MelvinBotFitseTLT
andcommitted
Clear pendingAction on hold/unhold report actions in successData
The hold/unhold report actions were created with pendingAction: ADD but successData only cleared pendingAction on the transaction, not on the report actions. This caused them to permanently retain pendingAction: 'add' in Onyx, which made OfflineWithFeedback grey them out whenever the user went offline — even after the server had already confirmed the action. Add successData entries in both putOnHold and unholdRequest to clear pendingAction on the hold-related report actions, following the existing pattern used for optimisticCreatedAction. Co-authored-by: Fitsum Abebe <FitseTLT@users.noreply.github.com>
1 parent 67a0cc0 commit 3373fa8

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/libs/actions/IOU/Hold.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ function putOnHold(transactionID: string, comment: string, initialReportID: stri
139139
pendingAction: null,
140140
},
141141
},
142+
{
143+
onyxMethod: Onyx.METHOD.MERGE,
144+
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
145+
value: {
146+
[createdReportAction.reportActionID]: {pendingAction: null},
147+
[createdReportActionComment.reportActionID]: {pendingAction: null},
148+
},
149+
},
142150
];
143151

144152
const failureData: Array<
@@ -409,7 +417,7 @@ function unholdRequest(transactionID: string, reportID: string, policy: OnyxEntr
409417
});
410418
}
411419

412-
const successData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.TRANSACTION | typeof ONYXKEYS.COLLECTION.REPORT>> = [
420+
const successData: Array<OnyxUpdate<typeof ONYXKEYS.COLLECTION.TRANSACTION | typeof ONYXKEYS.COLLECTION.REPORT | typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS>> = [
413421
{
414422
onyxMethod: Onyx.METHOD.MERGE,
415423
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
@@ -420,6 +428,13 @@ function unholdRequest(transactionID: string, reportID: string, policy: OnyxEntr
420428
},
421429
},
422430
},
431+
{
432+
onyxMethod: Onyx.METHOD.MERGE,
433+
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
434+
value: {
435+
[createdReportAction.reportActionID]: {pendingAction: null},
436+
},
437+
},
423438
];
424439

425440
const failureData: Array<

0 commit comments

Comments
 (0)