From f394b98be841fd314dade5cdba0e04198b8ade24 Mon Sep 17 00:00:00 2001 From: Peter Velkov Date: Tue, 27 Apr 2021 20:19:54 +0300 Subject: [PATCH] refactor: Reuse `updateCurrentlyViewedReportID` --- src/libs/actions/Report.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 936cbb3e6a28..63f92b6fbfa7 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -769,8 +769,8 @@ function fetchAllReports( } const firstReportID = _.first(reportIDs); - const currentReportID = firstReportID ? String(firstReportID) : ''; - Onyx.merge(ONYXKEYS.CURRENTLY_VIEWED_REPORTID, currentReportID); + // eslint-disable-next-line no-use-before-define + updateCurrentlyViewedReportID(firstReportID); }); } @@ -957,7 +957,7 @@ function handleReportChanged(report) { * @param {Number} reportID */ function updateCurrentlyViewedReportID(reportID) { - Onyx.merge(ONYXKEYS.CURRENTLY_VIEWED_REPORTID, String(reportID)); + Onyx.merge(ONYXKEYS.CURRENTLY_VIEWED_REPORTID, String(reportID || '')); } Onyx.connect({