From 4945240ec216927ec78abbce25b32b48eb5f7af7 Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Mon, 27 Mar 2023 20:14:39 +0000 Subject: [PATCH 1/2] fix: hide empty invoices section --- packages/web/src/components/Invoices/index.ee.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ( From d841f9cb621c6d881039130486e7e1266f856883 Mon Sep 17 00:00:00 2001 From: Faruk AYDIN Date: Tue, 28 Mar 2023 00:27:43 +0300 Subject: [PATCH 2/2] fix: Do not return invoices if there is no subscription --- packages/backend/src/graphql/queries/get-invoices.ee.ts | 5 +++++ 1 file changed, 5 insertions(+) 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) );