From 551e64d35ab6321849f1f61007338d870d2ba63c Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Wed, 4 Feb 2026 15:47:35 +0100 Subject: [PATCH] Make discover section always visible --- src/pages/home/DiscoverSection.tsx | 42 ++++++++++++------------------ 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/pages/home/DiscoverSection.tsx b/src/pages/home/DiscoverSection.tsx index 6cb3ff299709a..d704f927cd6a7 100644 --- a/src/pages/home/DiscoverSection.tsx +++ b/src/pages/home/DiscoverSection.tsx @@ -1,6 +1,5 @@ import React from 'react'; import {Image, Linking, View} from 'react-native'; -import type {OnyxValue} from 'react-native-onyx'; import HomeTestDriveImage from '@assets/images/home-testdrive-image.png'; import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; import {PressableWithoutFeedback} from '@components/Pressable'; @@ -14,19 +13,11 @@ import useParentReportAction from '@hooks/useParentReportAction'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import {completeTestDriveTask} from '@libs/actions/Task'; +import {setSelfTourViewed} from '@libs/actions/Welcome'; import {getTestDriveURL} from '@libs/TourUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {isEmptyObject} from '@src/types/utils/EmptyObject'; - -// This selector returns true if the user has seen the tour, or if the onboarding NVP is not loaded yet. Thanks to this, discover section does not disappear when the onboarding NVP is loaded. -function hasSeenTourSelector(onboarding: OnyxValue): boolean | undefined { - if (isEmptyObject(onboarding)) { - return true; - } - - return !!onboarding?.selfTourViewed; -} +import {hasSeenTourSelector} from '@src/selectors/Onboarding'; const MAX_NUMBER_OF_LINES_TITLE = 4; @@ -49,24 +40,25 @@ function DiscoverSection() { const handlePress = () => { Linking.openURL(getTestDriveURL(shouldUseNarrowLayout, introSelected, isCurrentUserPolicyAdmin)); - if (hasSeenTour || !viewTourTaskReport || viewTourTaskReport.stateNum === CONST.REPORT.STATE_NUM.APPROVED) { + if (hasSeenTour) { return; } - completeTestDriveTask( - viewTourTaskReport, - viewTourTaskParentReport, - isViewTourTaskParentReportArchived, - currentUserPersonalDetails.accountID, - hasOutstandingChildTask, - parentReportAction, - false, - ); - }; + if (viewTourTaskReport && viewTourTaskReport.stateNum !== CONST.REPORT.STATE_NUM.APPROVED) { + completeTestDriveTask( + viewTourTaskReport, + viewTourTaskParentReport, + isViewTourTaskParentReportArchived, + currentUserPersonalDetails.accountID, + hasOutstandingChildTask, + parentReportAction, + false, + ); + return; + } - if (hasSeenTour) { - return null; - } + setSelfTourViewed(false); + }; return (