Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import type {
PersonalDetails,
PersonalDetailsList,
PolicyReportField,
QuickAction,
RecentlyUsedReportFields,
ReportActionReactions,
ReportMetadata,
Expand Down Expand Up @@ -219,6 +220,12 @@ Onyx.connect({
callback: (val) => (allRecentlyUsedReportFields = val),
});

let quickAction: OnyxEntry<QuickAction> = {};
Onyx.connect({
key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
callback: (val) => (quickAction = val),
});

function clearGroupChat() {
Onyx.set(ONYXKEYS.NEW_GROUP_CHAT_DRAFT, null);
}
Expand Down Expand Up @@ -2449,6 +2456,15 @@ function leaveGroupChat(reportID: string) {
value: null,
},
];
// Clean up any quick actions for the report we're leaving from
if (quickAction?.chatReportID?.toString() === reportID) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though quickAction.chatReportID is defined as a string, I've noticed that it was actually stored as an int in Onyx. I'm not sure why, since every flow that I traced had it as a string before saving it to Onyx.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's strange. For me, chatReportID is stored as a string in onyx. I also do not see usage of int in any flow. Further, I also tried relogin and tried various flows and it still stores as string. Looks good to me though.

optimisticData.push({
onyxMethod: Onyx.METHOD.SET,
key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
value: null,
});
}

navigateToMostRecentReport(report);
API.write(WRITE_COMMANDS.LEAVE_GROUP_CHAT, {reportID}, {optimisticData});
}
Expand Down