diff --git a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/dashboards/[dashboardId]/page.tsx b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/dashboards/[dashboardId]/page.tsx index a26d773a..53eb8f4f 100644 --- a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/dashboards/[dashboardId]/page.tsx +++ b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/dashboards/[dashboardId]/page.tsx @@ -1,5 +1,4 @@ import PageLayout from '@/app/(app)/[organizationId]/[projectId]/page-layout'; -import { getExists } from '@/server/pageExists'; import { notFound } from 'next/navigation'; import { getDashboardById, getReportsByDashboardId } from '@openpanel/db'; @@ -20,7 +19,6 @@ export default async function Page({ const [dashboard, reports] = await Promise.all([ getDashboardById(dashboardId, projectId), getReportsByDashboardId(dashboardId), - getExists(organizationId), ]); if (!dashboard) { diff --git a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/dashboards/page.tsx b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/dashboards/page.tsx index 398ab32f..49cbea01 100644 --- a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/dashboards/page.tsx +++ b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/dashboards/page.tsx @@ -1,5 +1,4 @@ import PageLayout from '@/app/(app)/[organizationId]/[projectId]/page-layout'; -import { getExists } from '@/server/pageExists'; import { getDashboardsByProjectId } from '@openpanel/db'; @@ -16,10 +15,7 @@ interface PageProps { export default async function Page({ params: { projectId, organizationId }, }: PageProps) { - const [dashboards] = await Promise.all([ - getDashboardsByProjectId(projectId), - await getExists(organizationId, projectId), - ]); + const dashboards = await getDashboardsByProjectId(projectId); return ( diff --git a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/events/page.tsx b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/events/page.tsx index 032d85e1..264da7a2 100644 --- a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/events/page.tsx +++ b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/events/page.tsx @@ -5,7 +5,6 @@ import { eventQueryFiltersParser, eventQueryNamesFilter, } from '@/hooks/useEventQueryFilters'; -import { getExists } from '@/server/pageExists'; import { parseAsInteger } from 'nuqs'; import { getEventList, getEventsCount } from '@openpanel/db'; @@ -54,7 +53,6 @@ export default async function Page({ events: eventsFilter, filters, }), - getExists(organizationId, projectId), ]); return ( diff --git a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/page.tsx b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/page.tsx index 737aa546..62c984f8 100644 --- a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/page.tsx +++ b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/page.tsx @@ -9,7 +9,6 @@ import OverviewTopEvents from '@/components/overview/overview-top-events'; import OverviewTopGeo from '@/components/overview/overview-top-geo'; import OverviewTopPages from '@/components/overview/overview-top-pages'; import OverviewTopSources from '@/components/overview/overview-top-sources'; -import { getExists } from '@/server/pageExists'; import { db } from '@openpanel/db'; @@ -27,14 +26,11 @@ interface PageProps { export default async function Page({ params: { organizationId, projectId }, }: PageProps) { - const [share] = await Promise.all([ - db.shareOverview.findUnique({ - where: { - project_id: projectId, - }, - }), - getExists(organizationId, projectId), - ]); + const share = await db.shareOverview.findUnique({ + where: { + project_id: projectId, + }, + }); return ( diff --git a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/[profileId]/page.tsx b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/[profileId]/page.tsx index fe8b6f3d..793a6e1a 100644 --- a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/[profileId]/page.tsx +++ b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/[profileId]/page.tsx @@ -9,7 +9,6 @@ import { eventQueryFiltersParser, eventQueryNamesFilter, } from '@/hooks/useEventQueryFilters'; -import { getExists } from '@/server/pageExists'; import { getProfileName } from '@/utils/getters'; import { notFound } from 'next/navigation'; import { parseAsInteger, parseAsString } from 'nuqs'; @@ -63,7 +62,6 @@ export default async function Page({ getEventList(eventListOptions), getEventsCount(eventListOptions), getConversionEventNames(projectId), - getExists(organizationId, projectId), ]); const chartSelectedEvents: IChartEvent[] = [ diff --git a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/page.tsx b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/page.tsx index 278ed942..aa69df26 100644 --- a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/page.tsx +++ b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/profiles/page.tsx @@ -2,7 +2,6 @@ import PageLayout from '@/app/(app)/[organizationId]/[projectId]/page-layout'; import { OverviewFiltersButtons } from '@/components/overview/filters/overview-filters-buttons'; import { OverviewFiltersDrawer } from '@/components/overview/filters/overview-filters-drawer'; import { eventQueryFiltersParser } from '@/hooks/useEventQueryFilters'; -import { getExists } from '@/server/pageExists'; import { parseAsInteger } from 'nuqs'; import { StickyBelowHeader } from '../layout-sticky-below-header'; @@ -25,12 +24,10 @@ const nuqsOptions = { shallow: false, }; -export default async function Page({ +export default function Page({ params: { organizationId, projectId }, searchParams: { cursor, f }, }: PageProps) { - await getExists(organizationId, projectId); - return ( diff --git a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/reports/[reportId]/page.tsx b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/reports/[reportId]/page.tsx index 88c4ad59..1051caf9 100644 --- a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/reports/[reportId]/page.tsx +++ b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/reports/[reportId]/page.tsx @@ -1,9 +1,8 @@ import PageLayout from '@/app/(app)/[organizationId]/[projectId]/page-layout'; -import { getExists } from '@/server/pageExists'; import { Pencil } from 'lucide-react'; import { notFound } from 'next/navigation'; -import { getOrganizationBySlug, getReportById } from '@openpanel/db'; +import { getReportById } from '@openpanel/db'; import ReportEditor from '../report-editor'; @@ -16,12 +15,9 @@ interface PageProps { } export default async function Page({ - params: { reportId, organizationId, projectId }, + params: { reportId, organizationId }, }: PageProps) { - const [report] = await Promise.all([ - getReportById(reportId), - getExists(organizationId, projectId), - ]); + const report = await getReportById(reportId); if (!report) { return notFound(); diff --git a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/reports/page.tsx b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/reports/page.tsx index 636f0555..c2d2ee60 100644 --- a/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/reports/page.tsx +++ b/apps/dashboard/src/app/(app)/[organizationId]/[projectId]/reports/page.tsx @@ -1,9 +1,5 @@ import PageLayout from '@/app/(app)/[organizationId]/[projectId]/page-layout'; -import { getExists } from '@/server/pageExists'; import { Pencil } from 'lucide-react'; -import { notFound } from 'next/navigation'; - -import { getOrganizationBySlug } from '@openpanel/db'; import ReportEditor from './report-editor'; @@ -14,11 +10,7 @@ interface PageProps { }; } -export default async function Page({ - params: { organizationId, projectId }, -}: PageProps) { - await getExists(organizationId, projectId); - +export default function Page({ params: { organizationId } }: PageProps) { return ( [] = [getOrganizationBySlug(organizationSlug)]; - - if (projectId) { - promises.push(getProjectById(projectId)); - } - - const results = await Promise.all(promises); - - if (results.some((res) => !res)) { - return notFound(); - } - - return { - organization: results[0] as Awaited< - ReturnType - >, - project: results[1] as Awaited>, - }; -}