From 727b364beff706c2cbbf97194dc868aab4f85436 Mon Sep 17 00:00:00 2001 From: c3024 Date: Mon, 25 Nov 2024 20:21:13 +0530 Subject: [PATCH] update Onyx data in the function --- src/libs/actions/Welcome/index.ts | 7 ++++++- .../SidebarScreen/FloatingActionButtonAndPopover.tsx | 11 ++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/libs/actions/Welcome/index.ts b/src/libs/actions/Welcome/index.ts index 230b212292e2..607370ae3b5e 100644 --- a/src/libs/actions/Welcome/index.ts +++ b/src/libs/actions/Welcome/index.ts @@ -185,7 +185,12 @@ function resetAllChecks() { OnboardingFlow.clearInitialPath(); } -function setSelfTourViewed() { +function setSelfTourViewed(shouldUpdateOnyxDataOnlyLocally = false) { + if (shouldUpdateOnyxDataOnlyLocally) { + Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {selfTourViewed: true}); + return; + } + const optimisticData: OnyxUpdate[] = [ { onyxMethod: Onyx.METHOD.MERGE, diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx index 715203d83972..f0e8d2ba1781 100644 --- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx +++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx @@ -4,7 +4,7 @@ import type {ForwardedRef} from 'react'; import React, {forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'; import {View} from 'react-native'; import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; -import Onyx, {useOnyx} from 'react-native-onyx'; +import {useOnyx} from 'react-native-onyx'; import type {SvgProps} from 'react-native-svg'; import ConfirmModal from '@components/ConfirmModal'; import FloatingActionButton from '@components/FloatingActionButton'; @@ -562,14 +562,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu}: Fl description: translate('tour.exploreExpensify'), onSelected: () => { Link.openExternalLink(navatticURL); - // Mark the tour as seen only locally for anonymous users visiting public rooms - if (Session.isAnonymousUser()) { - Onyx.merge(ONYXKEYS.NVP_ONBOARDING, { - selfTourViewed: true, - }); - return; - } - Welcome.setSelfTourViewed(); + Welcome.setSelfTourViewed(Session.isAnonymousUser()); if (viewTourTaskReport) { Task.completeTask(viewTourTaskReport); }