diff --git a/packages/backend/src/graphql/queries/get-invoices.ee.ts b/packages/backend/src/graphql/queries/get-invoices.ee.ts index 527eed08..c745a4c6 100644 --- a/packages/backend/src/graphql/queries/get-invoices.ee.ts +++ b/packages/backend/src/graphql/queries/get-invoices.ee.ts @@ -7,6 +7,11 @@ const getInvoices = async ( context: Context ) => { const subscription = await context.currentUser.$relatedQuery('subscription'); + + if (!subscription) { + return; + } + const invoices = await Billing.paddleClient.getInvoices( Number(subscription.paddleSubscriptionId) ); diff --git a/packages/web/src/components/Invoices/index.ee.tsx b/packages/web/src/components/Invoices/index.ee.tsx index b64bc3a6..7e9b220a 100644 --- a/packages/web/src/components/Invoices/index.ee.tsx +++ b/packages/web/src/components/Invoices/index.ee.tsx @@ -13,7 +13,9 @@ import useFormatMessage from 'hooks/useFormatMessage'; export default function Invoices() { const formatMessage = useFormatMessage(); - const { invoices } = useInvoices(); + const { invoices, loading } = useInvoices(); + + if (loading || invoices.length === 0) return ; return (