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)
This commit is contained in:
Mantra 2026-04-28 13:16:33 -07:00 committed by GitHub
parent b3d0ab66cc
commit a82097db62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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");