From e651ba360ce9c32793cbf11bb83a6276aad08abf Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Thu, 19 Oct 2023 10:47:38 +0200 Subject: [PATCH] Rebased and resigned old commit tree. --- src/libs/actions/Policy.js | 2 +- src/libs/actions/Welcome.ts | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 4696ab2f0649..02dd45ce7969 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -162,7 +162,7 @@ function deleteWorkspace(policyID, reports, policyName) { /** * Is the user an admin of a free policy (aka workspace)? * - * @param {Record} policies + * @param {Record} [policies] * @returns {Boolean} */ function isAdminOfFreePolicy(policies) { diff --git a/src/libs/actions/Welcome.ts b/src/libs/actions/Welcome.ts index 5494f5437a76..29e0088ed689 100644 --- a/src/libs/actions/Welcome.ts +++ b/src/libs/actions/Welcome.ts @@ -50,9 +50,9 @@ Onyx.connect({ callback: (value) => { // If isFirstTimeNewExpensifyUser was true do not update it to false. We update it to false inside the Welcome.show logic // More context here https://github.com/Expensify/App/pull/16962#discussion_r1167351359 - if (!isFirstTimeNewExpensifyUser) { - isFirstTimeNewExpensifyUser = value ?? undefined; - } + + isFirstTimeNewExpensifyUser = value ?? undefined; + checkOnReady(); }, }); @@ -61,9 +61,7 @@ Onyx.connect({ key: ONYXKEYS.IS_LOADING_REPORT_DATA, initWithStoredValues: false, callback: (value) => { - if (value) { - isLoadingReportData = value; - } + isLoadingReportData = value ?? false; checkOnReady(); }, }); @@ -159,7 +157,7 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => false} // If user is not already an admin of a free policy and we are not navigating them to their workspace or creating a new workspace via workspace/new then // we will show the create menu. - if (allPolicies && !Policy.isAdminOfFreePolicy(allPolicies) && !isDisplayingWorkspaceRoute) { + if (!Policy.isAdminOfFreePolicy(allPolicies ?? undefined) && !isDisplayingWorkspaceRoute) { showCreateMenu(); }