Skip to content

Commit

Permalink
Merge pull request Expensify#24039 from tienifr/fix/23752-can-not-lea…
Browse files Browse the repository at this point in the history
…ve-room-offline-after-send-message

Fix: Cannot leave room in offline mode after adding comment
  • Loading branch information
MariaHCD authored Aug 10, 2023
2 parents 8d84c23 + c474122 commit 5ea37aa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1735,6 +1735,8 @@ function openReportFromDeepLink(url, isAuthenticated) {
* @param {String} reportID
*/
function leaveRoom(reportID) {
const report = lodashGet(allReports, [reportID], {});
const reportKeys = _.keys(report);
API.write(
'LeaveRoom',
{
Expand All @@ -1751,6 +1753,15 @@ function leaveRoom(reportID) {
},
},
],
// Manually clear the report using merge. Should not use set here since it would cause race condition
// if it was called right after a merge.
successData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: _.object(reportKeys, Array(reportKeys.length).fill(null)),
},
],
failureData: [
{
onyxMethod: Onyx.METHOD.SET,
Expand Down

0 comments on commit 5ea37aa

Please sign in to comment.