From 1c558eb6b3fbd7882377251258d6c3ebf5945ceb Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Tue, 11 Jun 2024 17:35:54 +0530 Subject: [PATCH] [WEB-1555] fix: analytics empty state flicker (#4754) * fix: analytics empty state flicker * chore: todo added --- .../(projects)/analytics/page.tsx | 85 ++++++++++--------- 1 file changed, 45 insertions(+), 40 deletions(-) diff --git a/web/app/[workspaceSlug]/(projects)/analytics/page.tsx b/web/app/[workspaceSlug]/(projects)/analytics/page.tsx index 5fd4104ee..240993a24 100644 --- a/web/app/[workspaceSlug]/(projects)/analytics/page.tsx +++ b/web/app/[workspaceSlug]/(projects)/analytics/page.tsx @@ -20,53 +20,58 @@ const AnalyticsPage = observer(() => { // store hooks const { toggleCreateProjectModal } = useCommandPalette(); const { setTrackElement } = useEventTracker(); - const { workspaceProjectIds } = useProject(); + const { workspaceProjectIds, loader } = useProject(); const { currentWorkspace } = useWorkspace(); // derived values const pageTitle = currentWorkspace?.name ? `${currentWorkspace?.name} - Analytics` : undefined; + // TODO: refactor loader implementation return ( <> - {workspaceProjectIds && workspaceProjectIds.length > 0 ? ( -
- - - {ANALYTICS_TABS.map((tab) => ( - - {({ selected }) => ( - - )} - - ))} - - - - - - - - - - -
- ) : ( - { - setTrackElement("Analytics empty state"); - toggleCreateProjectModal(true); - }} - /> + {workspaceProjectIds && ( + <> + {workspaceProjectIds.length > 0 || loader ? ( +
+ + + {ANALYTICS_TABS.map((tab) => ( + + {({ selected }) => ( + + )} + + ))} + + + + + + + + + + +
+ ) : ( + { + setTrackElement("Analytics empty state"); + toggleCreateProjectModal(true); + }} + /> + )} + )} );