Skip to content

Commit

Permalink
Merge pull request #4590 from Expensify/marcaaron-consolidateOnyxConnect
Browse files Browse the repository at this point in the history
[No QA] Remove duplicate subscription in Report.js file
  • Loading branch information
deetergp authored Aug 13, 2021
2 parents 1c3a797 + 15d53e0 commit 53e30cd
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,6 @@ Onyx.connect({

const allReports = {};
let conciergeChatReportID;
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
callback: (val) => {
if (val && val.reportID) {
allReports[val.reportID] = val;

if (isConciergeChatReport(val)) {
conciergeChatReportID = val.reportID;
}
}
},
});

const typingWatchTimers = {};

/**
Expand Down Expand Up @@ -1233,6 +1220,14 @@ function handleReportChanged(report) {
return;
}

if (report && report.reportID) {
allReports[report.reportID] = report;

if (isConciergeChatReport(report)) {
conciergeChatReportID = report.reportID;
}
}

// A report can be missing a name if a comment is received via pusher event
// and the report does not yet exist in Onyx (eg. a new DM created with the logged in person)
if (report.reportID && report.reportName === undefined) {
Expand Down

0 comments on commit 53e30cd

Please sign in to comment.