From bf9d6095da1b12af8ae4b6d7a2c1b991255ac992 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 2 Oct 2025 13:53:39 -0600 Subject: [PATCH] metric content preload --- apps/web/src/routeTree.gen.ts | 102 ++++++++++++++---- apps/web/src/routes/screenshots/_content.tsx | 12 +++ .../metrics.$metricId.content.tsx | 4 +- .../screenshots/metrics.$metricId.index.tsx | 2 +- 4 files changed, 94 insertions(+), 26 deletions(-) create mode 100644 apps/web/src/routes/screenshots/_content.tsx rename apps/web/src/routes/screenshots/{ => _content}/metrics.$metricId.content.tsx (74%) diff --git a/apps/web/src/routeTree.gen.ts b/apps/web/src/routeTree.gen.ts index cfc01d959..3fdcd2bc3 100644 --- a/apps/web/src/routeTree.gen.ts +++ b/apps/web/src/routeTree.gen.ts @@ -18,6 +18,7 @@ import { Route as AuthRouteImport } from './routes/auth' import { Route as AppRouteImport } from './routes/app' import { Route as IndexRouteImport } from './routes/index' import { Route as AppIndexRouteImport } from './routes/app/index' +import { Route as ScreenshotsContentRouteImport } from './routes/screenshots/_content' import { Route as InfoGettingStartedRouteImport } from './routes/info/getting-started' import { Route as AuthResetPasswordRouteImport } from './routes/auth.reset-password' import { Route as AuthLogoutRouteImport } from './routes/auth.logout' @@ -45,10 +46,10 @@ import { Route as AppAppDatasetsIndexRouteImport } from './routes/app/_app/datas import { Route as AppAppDashboardsIndexRouteImport } from './routes/app/_app/dashboards.index' import { Route as AppAppCollectionsIndexRouteImport } from './routes/app/_app/collections.index' import { Route as AppAppChatsIndexRouteImport } from './routes/app/_app/chats.index' -import { Route as ScreenshotsMetricsMetricIdContentRouteImport } from './routes/screenshots/metrics.$metricId.content' import { Route as AppSettingsRestricted_layoutAdmin_onlyRouteImport } from './routes/app/_settings/_restricted_layout/_admin_only' import { Route as AppAppHomeShortcutsRouteImport } from './routes/app/_app/home/shortcuts' import { Route as AppAppDatasetsDatasetIdRouteImport } from './routes/app/_app/datasets.$datasetId' +import { Route as ScreenshotsContentMetricsMetricIdContentRouteImport } from './routes/screenshots/_content/metrics.$metricId.content' import { Route as AppSettingsRestricted_layoutSettingsProfileRouteImport } from './routes/app/_settings/_restricted_layout/settings.profile' import { Route as AppSettingsPermissionsSettingsUsersRouteImport } from './routes/app/_settings/_permissions/settings.users' import { Route as AppSettingsPermissionsSettingsPermissionGroupsRouteImport } from './routes/app/_settings/_permissions/settings.permission-groups' @@ -157,6 +158,7 @@ import { ServerRoute as AuthConfirmServerRouteImport } from './routes/auth.confi import { ServerRoute as AuthCallbackServerRouteImport } from './routes/auth.callback' import { ServerRoute as ScreenshotsMetricsMetricIdIndexServerRouteImport } from './routes/screenshots/metrics.$metricId.index' +const ScreenshotsRouteImport = createFileRoute('/screenshots')() const EmbedChatChatIdReportsReportIdRouteImport = createFileRoute( '/embed/chat/$chatId/reports/$reportId', )() @@ -207,6 +209,11 @@ const AppAppAssetChatsChatIdDashboardsDashboardIdMetricsMetricIdRouteImport = )() const rootServerRouteImport = createServerRootRoute() +const ScreenshotsRoute = ScreenshotsRouteImport.update({ + id: '/screenshots', + path: '/screenshots', + getParentRoute: () => rootRouteImport, +} as any) const HealthcheckRoute = HealthcheckRouteImport.update({ id: '/healthcheck', path: '/healthcheck', @@ -237,6 +244,10 @@ const AppIndexRoute = AppIndexRouteImport.update({ path: '/', getParentRoute: () => AppRoute, } as any) +const ScreenshotsContentRoute = ScreenshotsContentRouteImport.update({ + id: '/_content', + getParentRoute: () => ScreenshotsRoute, +} as any) const InfoGettingStartedRoute = InfoGettingStartedRouteImport.update({ id: '/info/getting-started', path: '/info/getting-started', @@ -370,12 +381,6 @@ const AppAppChatsIndexRoute = AppAppChatsIndexRouteImport.update({ path: '/chats/', getParentRoute: () => AppAppRoute, } as any) -const ScreenshotsMetricsMetricIdContentRoute = - ScreenshotsMetricsMetricIdContentRouteImport.update({ - id: '/screenshots/metrics/$metricId/content', - path: '/screenshots/metrics/$metricId/content', - getParentRoute: () => rootRouteImport, - } as any) const AppSettingsRestricted_layoutAdmin_onlyRoute = AppSettingsRestricted_layoutAdmin_onlyRouteImport.update({ id: '/_admin_only', @@ -427,6 +432,12 @@ const AppAppAssetDashboardsDashboardIdRoute = path: '/dashboards/$dashboardId', getParentRoute: () => AppAppAssetRoute, } as any) +const ScreenshotsContentMetricsMetricIdContentRoute = + ScreenshotsContentMetricsMetricIdContentRouteImport.update({ + id: '/metrics/$metricId/content', + path: '/metrics/$metricId/content', + getParentRoute: () => ScreenshotsContentRoute, + } as any) const AppSettingsRestricted_layoutSettingsProfileRoute = AppSettingsRestricted_layoutSettingsProfileRouteImport.update({ id: '/settings/profile', @@ -1205,6 +1216,7 @@ export interface FileRoutesByFullPath { '/auth/logout': typeof AuthLogoutRoute '/auth/reset-password': typeof AuthResetPasswordRoute '/info/getting-started': typeof InfoGettingStartedRoute + '/screenshots': typeof ScreenshotsContentRouteWithChildren '/app/': typeof AppIndexRoute '/app/home': typeof AppAppHomeRouteWithChildren '/app/new-user': typeof AppAppNewUserRouteWithChildren @@ -1215,7 +1227,6 @@ export interface FileRoutesByFullPath { '/embed/report/$reportId': typeof EmbedReportReportIdRoute '/app/datasets/$datasetId': typeof AppAppDatasetsDatasetIdRouteWithChildren '/app/home/shortcuts': typeof AppAppHomeShortcutsRoute - '/screenshots/metrics/$metricId/content': typeof ScreenshotsMetricsMetricIdContentRoute '/app/chats': typeof AppAppChatsIndexRoute '/app/collections': typeof AppAppCollectionsIndexRoute '/app/dashboards': typeof AppAppDashboardsIndexRoute @@ -1235,6 +1246,7 @@ export interface FileRoutesByFullPath { '/app/settings/permission-groups': typeof AppSettingsPermissionsSettingsPermissionGroupsRouteWithChildren '/app/settings/users': typeof AppSettingsPermissionsSettingsUsersRouteWithChildren '/app/settings/profile': typeof AppSettingsRestricted_layoutSettingsProfileRoute + '/screenshots/metrics/$metricId/content': typeof ScreenshotsContentMetricsMetricIdContentRoute '/app/dashboards/$dashboardId': typeof AppAppAssetDashboardsDashboardIdLayoutRouteWithChildren '/app/metrics/$metricId': typeof AppAppAssetMetricsMetricIdLayoutRouteWithChildren '/app/reports/$reportId': typeof AppAppAssetReportsReportIdLayoutRouteWithChildren @@ -1342,13 +1354,13 @@ export interface FileRoutesByTo { '/auth/logout': typeof AuthLogoutRoute '/auth/reset-password': typeof AuthResetPasswordRoute '/info/getting-started': typeof InfoGettingStartedRoute + '/screenshots': typeof ScreenshotsContentRouteWithChildren '/app/test-pagination': typeof AppAppTestPaginationRoute '/embed/dashboard/$dashboardId': typeof EmbedDashboardDashboardIdRoute '/embed/metric/$metricId': typeof EmbedMetricMetricIdRoute '/embed/report/$reportId': typeof EmbedReportReportIdRoute '/app/datasets/$datasetId': typeof AppAppDatasetsDatasetIdRouteWithChildren '/app/home/shortcuts': typeof AppAppHomeShortcutsRoute - '/screenshots/metrics/$metricId/content': typeof ScreenshotsMetricsMetricIdContentRoute '/app/chats': typeof AppAppChatsIndexRoute '/app/collections': typeof AppAppCollectionsIndexRoute '/app/dashboards': typeof AppAppDashboardsIndexRoute @@ -1363,6 +1375,7 @@ export interface FileRoutesByTo { '/app/datasets/$datasetId/editor': typeof AppAppDatasetsDatasetIdEditorRoute '/app/datasets/$datasetId/overview': typeof AppAppDatasetsDatasetIdOverviewRoute '/app/settings/profile': typeof AppSettingsRestricted_layoutSettingsProfileRoute + '/screenshots/metrics/$metricId/content': typeof ScreenshotsContentMetricsMetricIdContentRoute '/app/dashboards/$dashboardId': typeof AppAppAssetDashboardsDashboardIdLayoutIndexRoute '/app/metrics/$metricId': typeof AppAppAssetMetricsMetricIdLayoutIndexRoute '/app/reports/$reportId': typeof AppAppAssetReportsReportIdLayoutIndexRoute @@ -1456,6 +1469,8 @@ export interface FileRoutesById { '/auth/logout': typeof AuthLogoutRoute '/auth/reset-password': typeof AuthResetPasswordRoute '/info/getting-started': typeof InfoGettingStartedRoute + '/screenshots': typeof ScreenshotsRouteWithChildren + '/screenshots/_content': typeof ScreenshotsContentRouteWithChildren '/app/': typeof AppIndexRoute '/app/_app/_asset': typeof AppAppAssetRouteWithChildren '/app/_app/home': typeof AppAppHomeRouteWithChildren @@ -1470,7 +1485,6 @@ export interface FileRoutesById { '/app/_app/datasets/$datasetId': typeof AppAppDatasetsDatasetIdRouteWithChildren '/app/_app/home/shortcuts': typeof AppAppHomeShortcutsRoute '/app/_settings/_restricted_layout/_admin_only': typeof AppSettingsRestricted_layoutAdmin_onlyRouteWithChildren - '/screenshots/metrics/$metricId/content': typeof ScreenshotsMetricsMetricIdContentRoute '/app/_app/chats/': typeof AppAppChatsIndexRoute '/app/_app/collections/': typeof AppAppCollectionsIndexRoute '/app/_app/dashboards/': typeof AppAppDashboardsIndexRoute @@ -1490,6 +1504,7 @@ export interface FileRoutesById { '/app/_settings/_permissions/settings/permission-groups': typeof AppSettingsPermissionsSettingsPermissionGroupsRouteWithChildren '/app/_settings/_permissions/settings/users': typeof AppSettingsPermissionsSettingsUsersRouteWithChildren '/app/_settings/_restricted_layout/settings/profile': typeof AppSettingsRestricted_layoutSettingsProfileRoute + '/screenshots/_content/metrics/$metricId/content': typeof ScreenshotsContentMetricsMetricIdContentRoute '/app/_app/_asset/dashboards/$dashboardId': typeof AppAppAssetDashboardsDashboardIdRouteWithChildren '/app/_app/_asset/dashboards/$dashboardId/_layout': typeof AppAppAssetDashboardsDashboardIdLayoutRouteWithChildren '/app/_app/_asset/metrics/$metricId': typeof AppAppAssetMetricsMetricIdRouteWithChildren @@ -1614,6 +1629,7 @@ export interface FileRouteTypes { | '/auth/logout' | '/auth/reset-password' | '/info/getting-started' + | '/screenshots' | '/app/' | '/app/home' | '/app/new-user' @@ -1624,7 +1640,6 @@ export interface FileRouteTypes { | '/embed/report/$reportId' | '/app/datasets/$datasetId' | '/app/home/shortcuts' - | '/screenshots/metrics/$metricId/content' | '/app/chats' | '/app/collections' | '/app/dashboards' @@ -1644,6 +1659,7 @@ export interface FileRouteTypes { | '/app/settings/permission-groups' | '/app/settings/users' | '/app/settings/profile' + | '/screenshots/metrics/$metricId/content' | '/app/dashboards/$dashboardId' | '/app/metrics/$metricId' | '/app/reports/$reportId' @@ -1751,13 +1767,13 @@ export interface FileRouteTypes { | '/auth/logout' | '/auth/reset-password' | '/info/getting-started' + | '/screenshots' | '/app/test-pagination' | '/embed/dashboard/$dashboardId' | '/embed/metric/$metricId' | '/embed/report/$reportId' | '/app/datasets/$datasetId' | '/app/home/shortcuts' - | '/screenshots/metrics/$metricId/content' | '/app/chats' | '/app/collections' | '/app/dashboards' @@ -1772,6 +1788,7 @@ export interface FileRouteTypes { | '/app/datasets/$datasetId/editor' | '/app/datasets/$datasetId/overview' | '/app/settings/profile' + | '/screenshots/metrics/$metricId/content' | '/app/dashboards/$dashboardId' | '/app/metrics/$metricId' | '/app/reports/$reportId' @@ -1864,6 +1881,8 @@ export interface FileRouteTypes { | '/auth/logout' | '/auth/reset-password' | '/info/getting-started' + | '/screenshots' + | '/screenshots/_content' | '/app/' | '/app/_app/_asset' | '/app/_app/home' @@ -1878,7 +1897,6 @@ export interface FileRouteTypes { | '/app/_app/datasets/$datasetId' | '/app/_app/home/shortcuts' | '/app/_settings/_restricted_layout/_admin_only' - | '/screenshots/metrics/$metricId/content' | '/app/_app/chats/' | '/app/_app/collections/' | '/app/_app/dashboards/' @@ -1898,6 +1916,7 @@ export interface FileRouteTypes { | '/app/_settings/_permissions/settings/permission-groups' | '/app/_settings/_permissions/settings/users' | '/app/_settings/_restricted_layout/settings/profile' + | '/screenshots/_content/metrics/$metricId/content' | '/app/_app/_asset/dashboards/$dashboardId' | '/app/_app/_asset/dashboards/$dashboardId/_layout' | '/app/_app/_asset/metrics/$metricId' @@ -2018,7 +2037,7 @@ export interface RootRouteChildren { EmbedRoute: typeof EmbedRouteWithChildren HealthcheckRoute: typeof HealthcheckRoute InfoGettingStartedRoute: typeof InfoGettingStartedRoute - ScreenshotsMetricsMetricIdContentRoute: typeof ScreenshotsMetricsMetricIdContentRoute + ScreenshotsRoute: typeof ScreenshotsRouteWithChildren } export interface FileServerRoutesByFullPath { '/auth/callback': typeof AuthCallbackServerRoute @@ -2059,6 +2078,13 @@ export interface RootServerRouteChildren { declare module '@tanstack/react-router' { interface FileRoutesByPath { + '/screenshots': { + id: '/screenshots' + path: '/screenshots' + fullPath: '/screenshots' + preLoaderRoute: typeof ScreenshotsRouteImport + parentRoute: typeof rootRouteImport + } '/healthcheck': { id: '/healthcheck' path: '/healthcheck' @@ -2101,6 +2127,13 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof AppIndexRouteImport parentRoute: typeof AppRoute } + '/screenshots/_content': { + id: '/screenshots/_content' + path: '/screenshots' + fullPath: '/screenshots' + preLoaderRoute: typeof ScreenshotsContentRouteImport + parentRoute: typeof ScreenshotsRoute + } '/info/getting-started': { id: '/info/getting-started' path: '/info/getting-started' @@ -2290,13 +2323,6 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof AppAppChatsIndexRouteImport parentRoute: typeof AppAppRoute } - '/screenshots/metrics/$metricId/content': { - id: '/screenshots/metrics/$metricId/content' - path: '/screenshots/metrics/$metricId/content' - fullPath: '/screenshots/metrics/$metricId/content' - preLoaderRoute: typeof ScreenshotsMetricsMetricIdContentRouteImport - parentRoute: typeof rootRouteImport - } '/app/_settings/_restricted_layout/_admin_only': { id: '/app/_settings/_restricted_layout/_admin_only' path: '' @@ -2360,6 +2386,13 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof AppAppAssetDashboardsDashboardIdRouteImport parentRoute: typeof AppAppAssetRoute } + '/screenshots/_content/metrics/$metricId/content': { + id: '/screenshots/_content/metrics/$metricId/content' + path: '/metrics/$metricId/content' + fullPath: '/screenshots/metrics/$metricId/content' + preLoaderRoute: typeof ScreenshotsContentMetricsMetricIdContentRouteImport + parentRoute: typeof ScreenshotsContentRoute + } '/app/_settings/_restricted_layout/settings/profile': { id: '/app/_settings/_restricted_layout/settings/profile' path: '/settings/profile' @@ -4179,6 +4212,30 @@ const EmbedRouteChildren: EmbedRouteChildren = { const EmbedRouteWithChildren = EmbedRoute._addFileChildren(EmbedRouteChildren) +interface ScreenshotsContentRouteChildren { + ScreenshotsContentMetricsMetricIdContentRoute: typeof ScreenshotsContentMetricsMetricIdContentRoute +} + +const ScreenshotsContentRouteChildren: ScreenshotsContentRouteChildren = { + ScreenshotsContentMetricsMetricIdContentRoute: + ScreenshotsContentMetricsMetricIdContentRoute, +} + +const ScreenshotsContentRouteWithChildren = + ScreenshotsContentRoute._addFileChildren(ScreenshotsContentRouteChildren) + +interface ScreenshotsRouteChildren { + ScreenshotsContentRoute: typeof ScreenshotsContentRouteWithChildren +} + +const ScreenshotsRouteChildren: ScreenshotsRouteChildren = { + ScreenshotsContentRoute: ScreenshotsContentRouteWithChildren, +} + +const ScreenshotsRouteWithChildren = ScreenshotsRoute._addFileChildren( + ScreenshotsRouteChildren, +) + const rootRouteChildren: RootRouteChildren = { IndexRoute: IndexRoute, AppRoute: AppRouteWithChildren, @@ -4186,8 +4243,7 @@ const rootRouteChildren: RootRouteChildren = { EmbedRoute: EmbedRouteWithChildren, HealthcheckRoute: HealthcheckRoute, InfoGettingStartedRoute: InfoGettingStartedRoute, - ScreenshotsMetricsMetricIdContentRoute: - ScreenshotsMetricsMetricIdContentRoute, + ScreenshotsRoute: ScreenshotsRouteWithChildren, } export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) diff --git a/apps/web/src/routes/screenshots/_content.tsx b/apps/web/src/routes/screenshots/_content.tsx new file mode 100644 index 000000000..f3817c9cf --- /dev/null +++ b/apps/web/src/routes/screenshots/_content.tsx @@ -0,0 +1,12 @@ +import { createFileRoute, Outlet } from '@tanstack/react-router'; + +export const Route = createFileRoute('/screenshots/_content')({ + component: RouteComponent, + beforeLoad: async ({ matches }) => { + // + }, +}); + +function RouteComponent() { + return ; +} diff --git a/apps/web/src/routes/screenshots/metrics.$metricId.content.tsx b/apps/web/src/routes/screenshots/_content/metrics.$metricId.content.tsx similarity index 74% rename from apps/web/src/routes/screenshots/metrics.$metricId.content.tsx rename to apps/web/src/routes/screenshots/_content/metrics.$metricId.content.tsx index 345de0133..3f34be6ee 100644 --- a/apps/web/src/routes/screenshots/metrics.$metricId.content.tsx +++ b/apps/web/src/routes/screenshots/_content/metrics.$metricId.content.tsx @@ -1,8 +1,8 @@ import { createFileRoute } from '@tanstack/react-router'; import { z } from 'zod'; -import { GetMetricScreenshotQuerySchema } from './metrics.$metricId.index'; +import { GetMetricScreenshotQuerySchema } from '../metrics.$metricId.index'; -export const Route = createFileRoute('/screenshots/metrics/$metricId/content')({ +export const Route = createFileRoute('/screenshots/_content/metrics/$metricId/content')({ component: RouteComponent, validateSearch: GetMetricScreenshotQuerySchema, ssr: true, diff --git a/apps/web/src/routes/screenshots/metrics.$metricId.index.tsx b/apps/web/src/routes/screenshots/metrics.$metricId.index.tsx index 086d1e918..ba17137b0 100644 --- a/apps/web/src/routes/screenshots/metrics.$metricId.index.tsx +++ b/apps/web/src/routes/screenshots/metrics.$metricId.index.tsx @@ -1,7 +1,7 @@ import { createServerFileRoute } from '@tanstack/react-start/server'; import { chromium } from 'playwright'; import { z } from 'zod'; -import { Route as MetricContentRoute } from './metrics.$metricId.content'; +import { Route as MetricContentRoute } from './_content/metrics.$metricId.content'; export const GetMetricScreenshotParamsSchema = z.object({ metricId: z.string(),