Skip to content

Commit

Permalink
refactor: Reuse updateCurrentlyViewedReportID
Browse files Browse the repository at this point in the history
  • Loading branch information
kidroca committed Apr 27, 2021
1 parent 1591d76 commit f394b98
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}

Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit f394b98

Please sign in to comment.