Skip to content

Open-source status page, incident response and uptime monitoring

Refactor: optimizing monitor page (#970)

Priyank Rajai1a8bf3fdcb45
diff --git a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx
index 279661265..3dcc5f8d4 100644
--- a/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx
+++ b/apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/(overview)/page.tsx
@@ -70,19 +70,20 @@ export default async function MonitorPage({
// use Suspense and Client call instead?
const monitorsWithData = await Promise.all(
monitors.map(async (monitor) => {
- const metrics = await tb.endpointMetrics("1d")(
- {
- monitorId: String(monitor.id),
- },
- { cache: "no-store", revalidate: 0 },
- );
-
- const data = await tb.endpointStatusPeriod("7d")(
- {
- monitorId: String(monitor.id),
- },
- { cache: "no-store", revalidate: 0 },
- );
+ const [metrics, data] = await Promise.all([
+ tb.endpointMetrics("1d")(
+ {
+ monitorId: String(monitor.id),
+ },
+ { cache: "no-store", revalidate: 0 },
+ ),
+ tb.endpointStatusPeriod("7d")(
+ {
+ monitorId: String(monitor.id),
+ },
+ { cache: "no-store", revalidate: 0 },
+ ),
+ ]);
const [current] = metrics?.sort((a, b) =>
(a.lastTimestamp || 0) - (b.lastTimestamp || 0) < 0 ? 1 : -1,