From 15d53e0e7cdf27d055e699400797fd39eadbd528 Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Wed, 11 Aug 2021 10:02:13 -1000 Subject: [PATCH] consolidate Onyx.connect call --- src/libs/actions/Report.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 4f9a766e8f36..53319dcee45c 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -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 = {}; /** @@ -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) {