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} > )}