From 459d4e8e47eb8f2c39421fae32f1f679c166a887 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 18 Apr 2024 16:32:49 +0700 Subject: [PATCH 1/3] fix just display track expense of selfDM is loaded --- .../sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx index b55fecf48ffb..eb8408998fa2 100644 --- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx +++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx @@ -260,6 +260,8 @@ function FloatingActionButtonAndPopover( } }; + const selfDMReportID = useMemo(() => ReportUtils.findSelfDMReportID(), [isLoading]); + return ( interceptAnonymousUser(Report.startNewChat), }, - ...(canUseTrackExpense + ...(canUseTrackExpense && selfDMReportID ? [ { icon: Expensicons.DocumentPlus, From 55b4f52ef2c9c290701268a9ba5b9e7bd3e67e04 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 18 Apr 2024 17:11:41 +0700 Subject: [PATCH 2/3] fix lint --- .../sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx index eb8408998fa2..b74a98a1a94a 100644 --- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx +++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx @@ -260,7 +260,10 @@ function FloatingActionButtonAndPopover( } }; - const selfDMReportID = useMemo(() => ReportUtils.findSelfDMReportID(), [isLoading]); + const selfDMReportID = useMemo(() => { + return ReportUtils.findSelfDMReportID(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [isLoading]); return ( From 0b61a9df1a444d9240664fd17d8d7661a6e7865f Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 18 Apr 2024 17:19:29 +0700 Subject: [PATCH 3/3] fix lint --- .../SidebarScreen/FloatingActionButtonAndPopover.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx index b74a98a1a94a..76ef4aff1ab4 100644 --- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx +++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.tsx @@ -259,11 +259,8 @@ function FloatingActionButtonAndPopover( showCreateMenu(); } }; - - const selfDMReportID = useMemo(() => { - return ReportUtils.findSelfDMReportID(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [isLoading]); + // eslint-disable-next-line react-hooks/exhaustive-deps + const selfDMReportID = useMemo(() => ReportUtils.findSelfDMReportID(), [isLoading]); return (