Skip to content

Commit

Permalink
consolidate Onyx.connect call
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed Aug 11, 2021
1 parent 3ec2137 commit 15d53e0
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 @@ -1227,6 +1214,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 15d53e0

Please sign in to comment.