From a82097db62c22920fa8f8e49ae2c7f6a4188e4b2 Mon Sep 17 00:00:00 2001 From: Mantra <87142457+mantrakp04@users.noreply.github.com> Date: Tue, 28 Apr 2026 13:16:33 -0700 Subject: [PATCH] refactor(dashboard): use getEnabledAppIds on metrics page (#1394) ## Summary Uses the shared `getEnabledAppIds` helper from `@/lib/apps-utils` instead of manually filtering installed apps with `typedEntries` on the project metrics page. ## Why Keeps enabled-app logic consistent with other dashboard code paths and slightly reduces duplication. ## Test plan - [ ] Smoke: open project metrics / overview and confirm installed app-dependent UI (e.g. analytics) still behaves as before. Made with [Cursor](https://cursor.com) --- .../projects/[projectId]/(overview)/metrics-page.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/metrics-page.tsx b/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/metrics-page.tsx index 5041a26b5..97a2e3deb 100644 --- a/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/metrics-page.tsx +++ b/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/(overview)/metrics-page.tsx @@ -6,6 +6,7 @@ import { Link } from "@/components/link"; import { useRouter } from "@/components/router"; import { cn, Typography } from "@/components/ui"; import { ALL_APPS_FRONTEND, type AppId, getAppPath } from "@/lib/apps-frontend"; +import { getEnabledAppIds } from "@/lib/apps-utils"; import { type MetricsEmailOverview, type MetricsRecentEmail, @@ -16,7 +17,6 @@ import { CompassIcon, EnvelopeIcon, EnvelopeOpenIcon, GlobeIcon, SquaresFourIcon import useResizeObserver from '@react-hook/resize-observer'; import { useUser } from "@stackframe/stack"; import { ALL_APPS } from "@stackframe/stack-shared/dist/apps/apps-config"; -import { typedEntries } from "@stackframe/stack-shared/dist/utils/objects"; import { stringCompare } from "@stackframe/stack-shared/dist/utils/strings"; import { ErrorBoundary } from "next/dist/client/components/error-boundary"; import { type ElementType, Suspense, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react"; @@ -997,9 +997,7 @@ function MetricsContent({ const router = useRouter(); const data = useMetricsOrThrow(adminApp, includeAnonymous); const installedApps = useMemo( - () => typedEntries(config.apps.installed) - .filter(([_, appConfig]) => appConfig?.enabled === true) - .map(([appId]) => appId as AppId), + () => getEnabledAppIds(config.apps.installed), [config.apps.installed] ); const analyticsEnabled = installedApps.includes("analytics");