From 9d61dc2f7ce0e7c1b5d47d387052dcee1454d059 Mon Sep 17 00:00:00 2001 From: Nafees Nazik <84864519+G3root@users.noreply.github.com> Date: Mon, 3 Apr 2023 15:20:39 +0530 Subject: [PATCH] fix: flash of grey when navigating to workflow page (#8038) * fix: flash of grey * fix: remove rendering null --- .../features/ee/workflows/pages/index.tsx | 63 ++++++++++--------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/packages/features/ee/workflows/pages/index.tsx b/packages/features/ee/workflows/pages/index.tsx index 934f6e02a4..c53177e8ad 100644 --- a/packages/features/ee/workflows/pages/index.tsx +++ b/packages/features/ee/workflows/pages/index.tsx @@ -79,9 +79,7 @@ function WorkflowsPage() { } }, [session.status, query.isLoading, allWorkflowsData]); - if (!query.data) return null; - - const profileOptions = query.data.profiles + const profileOptions = query?.data?.profiles .filter((profile) => !profile.readOnly) .map((profile) => { return { @@ -98,10 +96,11 @@ function WorkflowsPage() { title={t("workflows")} subtitle={t("workflows_to_automate_notifications")} CTA={ - query.data.profiles.length === 1 && + query?.data?.profiles.length === 1 && session.data?.hasValidLicense && allWorkflowsData?.workflows && - allWorkflowsData?.workflows.length > 0 ? ( + allWorkflowsData?.workflows.length && + profileOptions ? ( - ) : ( - <>> - ) + ) : null }> {isLoading ? ( ) : ( <> - {query.data.profiles.length > 1 && - allWorkflowsData?.workflows && - allWorkflowsData.workflows.length > 0 && ( - - + + + createMutation.mutate({ teamId })} + isLoading={createMutation.isLoading} + disableMobileButton={true} /> - - createMutation.mutate({ teamId })} - isLoading={createMutation.isLoading} - disableMobileButton={true} - /> - - )} - + + ) : null} + {profileOptions && profileOptions?.length ? ( + + ) : null} > )}