From 51a79335109f42d5e3598850b228c7c100825a10 Mon Sep 17 00:00:00 2001 From: Tyler Date: Fri, 10 Jul 2026 09:08:34 -0600 Subject: [PATCH] fix(ga4): use sdk.cma directly in Sidebar instead of useCMA [AIS-59] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit useCMA() from react-apps-toolkit internally calls createClient() from contentful-management, which can fail due to CJS/ESM interop issues introduced in newer app-sdk versions. Mirrors the fix applied to AssignContentTypeSection in the config screen — use sdk.cma directly since app-sdk >= 4.20 exposes it on the SDK instance. Co-Authored-By: Claude Sonnet 4.6 --- apps/google-analytics-4/frontend/src/locations/Sidebar.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/google-analytics-4/frontend/src/locations/Sidebar.tsx b/apps/google-analytics-4/frontend/src/locations/Sidebar.tsx index 1984f175b..41ac0d8a2 100644 --- a/apps/google-analytics-4/frontend/src/locations/Sidebar.tsx +++ b/apps/google-analytics-4/frontend/src/locations/Sidebar.tsx @@ -1,5 +1,5 @@ import AnalyticsApp from 'components/main-app/AnalyticsApp/AnalyticsApp'; -import { useCMA, useSDK } from '@contentful/react-apps-toolkit'; +import { useSDK } from '@contentful/react-apps-toolkit'; import { SidebarExtensionSDK } from '@contentful/app-sdk'; import { useMemo } from 'react'; import { Skeleton } from '@contentful/f36-components'; @@ -13,7 +13,6 @@ import { contentfulContext } from 'helpers/contentfulContext'; const Sidebar = () => { const sdk = useSDK(); - const cma = useCMA(); const installationParameters = sdk.parameters.installation as | AppInstallationParameters | undefined; @@ -26,8 +25,8 @@ const Sidebar = () => { (rule) => rule.contentTypeId === currentContentType ); const api = useMemo( - () => new Api(contentfulContext(sdk), cma, serviceAccountKeyId), - [cma, sdk, serviceAccountKeyId] + () => new Api(contentfulContext(sdk), sdk.cma, serviceAccountKeyId), + [sdk, serviceAccountKeyId] ); const hasInstallationParams = serviceAccountKeyId && propertyId;